Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to multiple related plots in matlab

Subject: how to multiple related plots in matlab

From: matlab_learner

Date: 21 Apr, 2011 01:32:29

Message: 1 of 2

Hello. I want to make a comparison plot of same parameters at
different ranges on the same graph.
Any idea how to do it? I have different results (or values) for x and
y depending on how I change a constituent in the equation (Temperature
at cold end Tc) that produces x and y, and would like to view the
different results all on the same graph.

For example, at Tc = 20, I have these values for x and y
x = [130.3844847 127.1214462 123.8576889 120.5932128 117.3280179
114.0621041 110.7954716 107.5281202 104.26005 100.991261 97.72175326
94.45152666 91.18058125 87.90891703 84.636534 73.50505501]

and the corresponding values for y is

y = [1.065331708 1.00923384 0.955126697 0.902894269 0.852429244
0.803632212 0.756410941 0.710679747 0.666358915 0.623374192
0.581656319 0.541140621 0.501766632 0.463477753 0.42622095
0.306621922]

so i can do a simple plot(x,y) to get a graph of this.

Then, at Tc = 60, my data becomes

x=[100.7950325 97.53774443 94.27973759 91.02101195 45471.27907
84.50140422 81.24052214 77.97892125 74.71660156 71.45356305
68.18980574 64.92532961 61.66013468 58.39422093 55.12758838
44.01566101]

and y is
y=[1.091980538 1.028630986 0.967687238 0.908999312 0.852429244
0.797849903 0.745143946 0.69420289 0.644926292 0.597221011 0.551000557
0.506184503 0.462697961 0.420471112 0.37943878 0.248074647]

I can also do plot(x,y) and get a feel for how this one looks.

So, please, how can I plot this two sets of data on one graph and
compare?


I tried to do like a
x1 = [130.3844847 127.1214462 123.8576889 120.5932128 117.3280179
114.0621041 110.7954716 107.5281202 104.26005 100.991261 97.72175326
94.45152666 91.18058125 87.90891703 84.636534 73.50505501]

And y1 is

y1 = [1.065331708 1.00923384 0.955126697 0.902894269 0.852429244
0.803632212 0.756410941 0.710679747 0.666358915 0.623374192
0.581656319 0.541140621 0.501766632 0.463477753 0.42622095
0.306621922]

Then, at Tc = 60, my data becomes

x2=[100.7950325 97.53774443 94.27973759 91.02101195 45471.27907
84.50140422 81.24052214 77.97892125 74.71660156 71.45356305
68.18980574 64.92532961 61.66013468 58.39422093 55.12758838
44.01566101]

And y2 is
y2=[1.091980538 1.028630986 0.967687238 0.908999312 0.852429244
0.797849903 0.745143946 0.69420289 0.644926292 0.597221011 0.551000557
0.506184503 0.462697961 0.420471112 0.37943878 0.248074647]


plotmatrix(:,1) =x1;
plotmatrix(:,2)=x2;
pu(:,1) = y1;
pu(:,2)=y2;
but having "Subscripted assignment dimension mismatch."

I have tried a few variations but unable to resolve. My idea in this
example was to contain all data in a single container and then plot
them, in hope Matlab would map them together.

If you know of a way to do this, even in Excel, that would be welcome.
Thanks.

Subject: how to multiple related plots in matlab

From: TideMan

Date: 21 Apr, 2011 10:01:34

Message: 2 of 2

On Apr 21, 1:32 pm, matlab_learner <cib...@gmail.com> wrote:
> Hello. I want to make a comparison plot of same parameters at
> different ranges on the same graph.
> Any idea how to do it? I have different results (or values) for x and
> y depending on how I change a constituent in the equation (Temperature
> at cold end Tc) that produces x and y, and would like to view the
> different results all on the same graph.
>
> For example, at Tc = 20, I have these values for x and y
> x = [130.3844847        127.1214462     123.8576889     120.5932128     117.3280179
> 114.0621041     110.7954716     107.5281202     104.26005       100.991261      97.72175326
> 94.45152666     91.18058125     87.90891703     84.636534       73.50505501]
>
> and the corresponding values for y is
>
> y = [1.065331708        1.00923384      0.955126697     0.902894269     0.852429244
> 0.803632212     0.756410941     0.710679747     0.666358915     0.623374192
> 0.581656319     0.541140621     0.501766632     0.463477753     0.42622095
> 0.306621922]
>
> so i can do a simple plot(x,y) to get a graph of this.
>
> Then, at Tc = 60, my data becomes
>
> x=[100.7950325  97.53774443     94.27973759     91.02101195     45471.27907
> 84.50140422     81.24052214     77.97892125     74.71660156     71.45356305
> 68.18980574     64.92532961     61.66013468     58.39422093     55.12758838
> 44.01566101]
>
> and y is
> y=[1.091980538  1.028630986     0.967687238     0.908999312     0.852429244
> 0.797849903     0.745143946     0.69420289      0.644926292     0.597221011     0.551000557
> 0.506184503     0.462697961     0.420471112     0.37943878      0.248074647]
>
> I can also do plot(x,y) and get a feel for how this one looks.
>
> So, please, how can I plot this two sets of data on one graph and
> compare?
>
> I tried to do like a
> x1 = [130.3844847       127.1214462     123.8576889     120.5932128     117.3280179
> 114.0621041     110.7954716     107.5281202     104.26005       100.991261      97.72175326
> 94.45152666     91.18058125     87.90891703     84.636534       73.50505501]
>
> And y1 is
>
> y1 = [1.065331708       1.00923384      0.955126697     0.902894269     0.852429244
> 0.803632212     0.756410941     0.710679747     0.666358915     0.623374192
> 0.581656319     0.541140621     0.501766632     0.463477753     0.42622095
> 0.306621922]
>
> Then, at Tc = 60, my data becomes
>
> x2=[100.7950325 97.53774443     94.27973759     91.02101195     45471.27907
> 84.50140422     81.24052214     77.97892125     74.71660156     71.45356305
> 68.18980574     64.92532961     61.66013468     58.39422093     55.12758838
> 44.01566101]
>
> And y2 is
> y2=[1.091980538 1.028630986     0.967687238     0.908999312     0.852429244
> 0.797849903     0.745143946     0.69420289      0.644926292     0.597221011     0.551000557
> 0.506184503     0.462697961     0.420471112     0.37943878      0.248074647]
>
> plotmatrix(:,1) =x1;
> plotmatrix(:,2)=x2;
> pu(:,1) = y1;
> pu(:,2)=y2;
> but having "Subscripted assignment dimension mismatch."
>
> I have tried a few variations but unable to resolve. My idea in this
> example was to contain all data in a single container and then plot
> them, in hope Matlab would map them together.
>
> If you know of a way to do this, even in Excel, that would be welcome.
> Thanks.

plot(x1,y1,x2,y2)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us