if true
% clc;
clear all;
for m=1:5
a=randi([0, 100]);
b=randi([0, 100]);
c=randi([0, 100]);
d=randi([0, 100]);
z0=complex(a,b);
z1=complex(c,d);
alpha=complex(randi([0, 100]),randi([0, 100]));
k=50000;
Zarray = zeros(k,2);
for n=1:k
Z=((alpha*z1)/(1+z0));
z0=z1;
z1=Z;
Zarray(n,1) = real(Z);
Zarray(n,2) = imag(Z);
end
fig=figure('Visible','on');
plot(Zarray(:,1), Zarray(:,2),'r*');
%plot3(1:k,Zarray(:,1), Zarray(:,2),'b*');
xlabel('Real','fontsize',15);
ylabel('Imaginary','fontsize',15);
zlabel('Sequence Order','fontsize',15);
%saveas(fig,'fig.bmp');
end
end
This code will generate 5 figures. My aim to get a single figure merged of these five figures.
How do I do that? Please help.

 採用された回答

Titus Edelhofer
Titus Edelhofer 2015 年 7 月 3 日

0 投票

Hi,
replace the line
fig=figure('Visible','on');
by
subplot(5, 1, m);
Titus

6 件のコメント

Sk. Sarif Hassan
Sk. Sarif Hassan 2015 年 7 月 3 日
Sir. I want overlapped images. One merge another with different colors. Could it be possible?
Titus Edelhofer
Titus Edelhofer 2015 年 7 月 3 日
With "merged" you mean the plots to appear in the same plot? Then replace the call to figure with
hold on
This will add the next plot to the previous.
Titus
Sk. Sarif Hassan
Sk. Sarif Hassan 2015 年 7 月 3 日
編集済み: Sk. Sarif Hassan 2015 年 7 月 3 日
fig=figure('Visible','on');
hold on;
plot(Zarray(:,1), Zarray(:,2),'r*');
It is coming all 5 figures. please let me know...how I should write it.
Titus Edelhofer
Titus Edelhofer 2015 年 7 月 3 日
Delete the line fig=figure(...). This opens a new figure instead of reusing the previous.
Sk. Sarif Hassan
Sk. Sarif Hassan 2015 年 7 月 3 日
Yes. Figure is now okay. But all plots are in same color. So it is difficult to distinguish. is it possible to have different color?
Titus Edelhofer
Titus Edelhofer 2015 年 7 月 3 日
plot(Zarray(:,1), Zarray(:,2),'r*');
forces the color to be red ("r"). In R2014b and newer, leave out the colore and it's automatically changed. For previous versions do something like
col = {'r*', 'b*', 'c*', 'k*', 'g'};
...
plot(..., col{m});

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by