MATLAB Answers

Why my plotting curves exceed the loop index?

1 view (last 30 days)
Wiqas Ahmad
Wiqas Ahmad on 25 May 2021
Commented: Wiqas Ahmad on 25 May 2021
Why I see three plotting curves while my loop index j runs twice?
close all;
clear all;
clc;
%% ------------------------------Program-------------------------------------
z=2860:11:3135;
FOV=[1 2];
n=2;
col=['r' 'b'];
[m,~]=size(n);
lineHandles = gobjects(1,m);
for i=1:length(FOV)
for j=1:n
figure (3),
hold on
I0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_I0.dat']);
Q0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_Q0.dat']);
I(i,:)= smooth(sum(I0,2));
Q(i,:)= smooth(sum(Q0,2));
dep(i,:)= (I(i,:)-Q(i,:))./(I(i,:)+Q(i,:));
depr(i,:)=(dep(1,:)./dep(2,:));
plot(depr(i,:),z,'LineWidth',1.5,'color',col(:,j));
title('\fontname{Arial}Inhomogeneous clouds','Fontsize',12);
%legend('\delta_{in}/\delta_{out}','location','Southeast');
legend('CM1','CM2','location','Southeast');
xlabel('Depolarization ratio \delta_{rat}');
ylabel('\fontname{Arial}Cloud depth (m)');
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','off','Fontname','Arial','Fontsmoothing','on');
set(gca,'xlim',[0 1.6],'xtick',[0:0.2:1.6],'ylim',[2850 3150],'ytick',[2850:60:3150]);
set(gca,'xgrid','on','ygrid','on','gridcolor','k')
end
end

Answers (2)

VBBV
VBBV on 25 May 2021
what is the size of depr(i,:) matrix ?
  3 Comments
Wiqas Ahmad
Wiqas Ahmad on 25 May 2021
Thank you for your comment. I have almost solved it.

Sign in to comment.


Sulaymon Eshkabilov
Sulaymon Eshkabilov on 25 May 2021
Hi,
There might be a couple or more possible cases. Presumably (preassumption without seeing your data), one of your imported data sets contains two sets of data instead of one.
Don'r foget to use hold off as well once all done. This could be another possible case scenario.
  1 Comment
Wiqas Ahmad
Wiqas Ahmad on 25 May 2021
Thank you for your comment. I have almost solved it.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!