Académique Documents
Professionnel Documents
Culture Documents
clc;
close all;
clear;
%--------------------------------------------------------------------------
% Entrada de dados
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% (Adicionar comentrios sobre o que cada trecho do programa faz.)
%--------------------------------------------------------------------------
num_linhas = 10;
num_colunas = 14;
P = rand(num_linhas, num_colunas);
[X,Y] = meshgrid(1:num_colunas, 1:num_linhas); % [X,Y] Matriz das posicoes (eixos
'x' e 'y')
%--------------------------------------------------------------------------
% Plota os resultados de potencial medidos
%--------------------------------------------------------------------------
surfc(X,Y,P); % Plota a superficie 3D ja com curvas de nivel
% surfc(X,Y,Z) uses Z for the color data and surface height. X and Y are
% vectors or matrices defining the x and y components of a surface.
% If X and Y are vectors, length(X) = n and length(Y) = m,
% where [m,n] = size(Z).
% In this case, the vertices of the surface faces are (X(j),
% Y(i), Z(i,j)) triples. To create X and Y matrices for arbitrary
% domains, use the meshgrid function.
xlabel('X');
ylabel('Y');
zlabel('Tensao medida [V]');
title('Ttulo...');
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Prepara janela e plota as linhas equipotenciais
%--------------------------------------------------------------------------
figure % abre uma janela de figura
hold on % mantem a janela aberta para plotar
contour(X,Y,P); %Plota as curvas de nivel no intervalo em [v];
% A contour plot displays isolines of matrix Z.
% contour(Z) draws a contour plot of matrix Z, where Z is
% interpreted as heights with respect to the x-y plane. Z must
% be at least a 2-by-2 matrix that contains at least two different values.
% The number of contour lines and the values of the contour lines are
% chosen automatically based on the minimum and maximum values of Z.
%The ranges of the x- and y-axis are [1:n] and [1:m], where [m,n] = size(Z).
xlabel('X');
ylabel('Y');
title('Ttulo...');
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Prepara janela e plota o campo eletrico
%--------------------------------------------------------------------------
figure % abre uma janela de figura
hold on % mantem a janela aberta para plotar
contour(X,Y,P); % Plota novamente as linhas equipoteciais na nova janela
xlabel('X');
ylabel('Y');
title('Ttulo...');