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:
A simple 2-D graph

Subject: A simple 2-D graph

From: Tiger

Date: 6 Jul, 2013 15:21:51

Message: 1 of 3

Hello,

x = d
y = 1 - u + d * u

d takes continous values from 0 to 0.75 (d: [0, 0.75])
u takes continous values from 0 to 1.

I would like to plot y against x. I am trying to instruct matlab to
plot this? plot(x,y) might do it but apperantly I need to define d and
u as continous variables within the specified ranges.

Could you give some idea?

Subject: A simple 2-D graph

From: Salim

Date: 6 Jul, 2013 15:50:17

Message: 2 of 3

Firstly, you should determine equal numbers for u and d vectors, otherwise matlab gives error for * operation between u and d. You also need to take transpose of one of them (u=u'). (Below u-- 76x1 double and d--1x76 double). You can increase the resulation of plot by increasing the intervals to close continious values.

u=[0:0.0133:1];
u=u';
d=[0:0.01:0.75];
x=d;
y=1-u+d*u;
figure(1), plot(x,y);


Tiger <ptiger@hotmail.nl> wrote in message <kr9cbr$8u3$1@dont-email.me>...
> Hello,
>
> x = d
> y = 1 - u + d * u
>
> d takes continous values from 0 to 0.75 (d: [0, 0.75])
> u takes continous values from 0 to 1.
>
> I would like to plot y against x. I am trying to instruct matlab to
> plot this? plot(x,y) might do it but apperantly I need to define d and
> u as continous variables within the specified ranges.
>
> Could you give some idea?

Subject: A simple 2-D graph

From: Tiger

Date: 6 Jul, 2013 19:58:19

Message: 3 of 3

On 2013-07-06 15:50:17 +0000, Salim said:

> Firstly, you should determine equal numbers for u and d vectors,
> otherwise matlab gives error for * operation between u and d. You also
> need to take transpose of one of them (u=u'). (Below u-- 76x1 double
> and d--1x76 double). You can increase the resulation of plot by
> increasing the intervals to close continious values.
> u=[0:0.0133:1];
> u=u';
> d=[0:0.01:0.75];
> x=d;
> y=1-u+d*u;
> figure(1), plot(x,y);
>
>
> Tiger <ptiger@hotmail.nl> wrote in message <kr9cbr$8u3$1@dont-email.me>...
>> Hello,
>>
>> x = d
>> y = 1 - u + d * u
>>
>> d takes continous values from 0 to 0.75 (d: [0, 0.75])
>> u takes continous values from 0 to 1.
>>
>> I would like to plot y against x. I am trying to instruct matlab to
>> plot this? plot(x,y) might do it but apperantly I need to define d and
>> u as continous variables within the specified ranges.
>>
>> Could you give some idea?

Thank you very much for the answer.

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