plotting a family of curves

21 views (last 30 days)
Ewen Chan
Ewen Chan on 18 May 2018
So I have a code that is something like this:
I'll first show what the code that produces the original picture looks like and then I'll ask about my second code and the picture that I WANT it to make, but am having troubles trying to get MATLAB to make it (which is what I would like to get help in regards to).
for c0=2:5
parfor i=1:16
ChangeParameter(i)=i*43.5;
Optimum(i)=somefunction(c0,ChangeParameter(i),c2,e1,e2,p,pi,N);
end
end
And that makes this picture:
Now, what I want to do is something like this:
for c0=2:5
for k=1:6
e2(k)=k*0.001;
for j=1:6
e1(j)=j*0.001;
parfor i=1:16
ChangeParameter(i)=i*43.5;
Optimum(i,j,k)=somefunction(c0,ChangeParameter(i),c2,e1(j),e2(k),p,pi,N);
end
end
end
end
(Basically to create a family of curves)
And I want it to make it to make a plot like this:
How would I go about doing that?
The way that I have it, the error message that it says is that the data cannot have more than 2 dimensions, which I get, but what I don't get is I don't want to have to write out the data for each of the plots as a .mat file only for me to then re-assemble it into a single plot that shows the variation of the e1 and e2 variables/parameters in order to produce a plot that shows the family of curves.
What would be the best way for me to do that?
As always, your help is greatly appreciated.
Thank you.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!