Adding the results of several pcolor graphs...
이전 댓글 표시
Hello everyone: I am having difficulties, as I have made a program which calculates some values which it later represents in a pcolor graph (I will paste the code below). The values are calculated one by one in terms of two variables (n_re and n_im) and the color map just indicates the mean difference between my theoretical Contrast (Cteo) and my experimental Contrast (Cexp). The problem is that even though it obtains the correct answers each time (I've tried calculating just one value at a time) if done individually, it only displays in the pcolor graph the last value calculated if a series of values are used (loaded from a table experimental_values_M2612)I need some function or an idea of how I could manage to get each individual result obtained by the program and display it as one overall pcolor graph where I can see a real minimum for ALL my results instead of just one at a time.
function [] = mapa
m=30;
n_re=linspace(1,6,m);
n_im=linspace(0,5,m);
% z=zeros(m,m);
global lambda0;
lambda0=500;
% global z;
% z=[m,m];
load('C:\Users\Weinberg\Desktop\Prueba matlab\Prueba pcolor_V1\Samples\experimental_values_M2612')
tic
for v=1:20
d=Experimental_values(v,1);
Cexp=Experimental_values(v,3);
for i=1:m
for j=1:m
n=n_re(i)+1i*n_im(j);
z(i,j)=cx2(lambda0,d,n,Cexp);
end
end
pcolor(n_re,n_im,z);shading interp; colormap(jet);
toc
end
end
function [x2]=cx2(lambda0,d,n,Cexp)
x2=(Cexp-Cteo(lambda0,d,n)).^2;
end
function [C]=Cteo(lambda0,d,n)
nair=1;
dSiO2=285;
nSi=2
nSiO2=2
%calcular el contraste teorico
mSiO2=Sij(nair,nSiO2)*Pj(nSiO2,dSiO2,lambda0)*Sij(nSiO2,nSi);
mflake= Sij(nair,n)*Pj(n,d,lambda0)...
*Sij(n,nSiO2)*Pj(nSiO2,dSiO2,lambda0)*Sij(nSiO2,nSi);
rSiO2=abs(mSiO2(2,1)/mSiO2(1,1))^2;
rflake=abs(mflake(2,1)/mflake(1,1))^2;
C =(rflake-rSiO2)/(rflake+rSiO2);
end
Any help will be greatly appreciated, and thank to anyone that can help me in advance. Guillermo
댓글 수: 6
Guillermo Lopez
2012년 4월 19일
Guillermo Lopez
2012년 4월 19일
Image Analyst
2012년 4월 19일
It's difficult for us to understand or visualize what you want. Can you upload your data to your favorite web site so people can download it and try your code?
Walter Roberson
2012년 4월 19일
http://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Guillermo Lopez
2012년 4월 20일
Guillermo Lopez
2012년 4월 20일
답변 (2개)
Jan
2012년 4월 19일
Another idea would be to create the axes explicitely and setting the 'NextPlot' property:
AxesH = axes('NextPlot', 'add');
for v=1:20
...
pcolor(..., 'Parent', AxesH);
댓글 수: 4
Guillermo Lopez
2012년 4월 19일
Guillermo Lopez
2012년 4월 19일
Jan
2012년 4월 19일
Do you draw the PCOLOR areas to the same location? Then of course the conceal eachother.
Guillermo Lopez
2012년 4월 20일
Image Analyst
2012년 4월 19일
1 개 추천
I assume you know that pcolor does not color the "tiles" according to what their value is, like image, imagesc, or imshow does. If you didn't know that, then switch to one of those functions.
댓글 수: 5
Guillermo Lopez
2012년 4월 19일
Guillermo Lopez
2012년 4월 19일
Guillermo Lopez
2012년 4월 19일
Image Analyst
2012년 4월 19일
You already have the matrix as a variable. You needed that before you displayed it. If you want to save a picture of the figure window, use export_fig (in the Mathworks File Exchange).
Guillermo Lopez
2012년 4월 20일
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!