Multiple Graphs of different function

1 次查看(过去 30 天)
Hi
I would like to know how to how to show multiple graphs of different functions in one graph. My teacher wants it like that she will click she want let say 4 graphs and it will show her 4 graphs when she click 2 graphs it will show her 2 graphs ... a got the functions but that graph showing is not working
This is what i have got :
function [] = Function()
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
A=input('How many graphs you want:');
x= 1:0.01:5;
for i = -1:0.001:3
if A==1
subplot(1,4,1);plot(i.*(5.^x))
if A==2
subplot(1,4,2);plot(i.*(5.^2.*x))
if A==3
subplot(1,4,3);plot(i.*(5.^3.*x))
if A==4
subplot(1,4,4);plot(i.*(5.^4.*x))
end
end
end
end
end
end
Thanks in advance for help

采纳的回答

Star Strider
Star Strider 2016-3-30
I am not certain what you want to do in your plots.
If I understand correctly, the easiest way to do this is with a for loop:
A = 2;
x= 1:0.01:5;
i = -1:0.001:3;
for k1 = 1:A
subplot(A, 1, k1)
plot(5*x.^k1)
end
Experiment with this to get the result you want.
  6 个评论
Luke Libovic
Luke Libovic 2016-3-30
Thank you very much .. you helped a lot :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by