Thread Subject: for loop help

Subject: for loop help

From: AMK

Date: 12 Mar, 2010 19:15:01

Message: 1 of 4

Could someone show a basic for loop that could produce the below results?

L1.slope = [-59.3968 -56.9777 -54.7794 -51.587 -48.3138 -46.1093];
L1.int = [571.9502 566.8451 560.12 550.4008 539.3366 530.5057];

% LW is computed with above slope and intercept given measured windspeed.
L1.a = L1.slope(1:1)*v+L1.int(1:1);
L1.b = L1.slope(2:2)*v+L1.int(2:2);
L1.c = L1.slope(3:3)*v+L1.int(3:3);
L1.d = L1.slope(4:4)*v+L1.int(4:4);
L1.e = L1.slope(5:5)*v+L1.int(5:5);
L1.f = L1.slope(6:6)*v+L1.int(6:6);

LW = [L1.a L1.b L1.c L1.d L1.e L1.f];

Subject: for loop help

From: Sean

Date: 12 Mar, 2010 19:31:27

Message: 2 of 4

AMK <kennaster@gmail.com> wrote in message <1517414598.370865.1268421331497.JavaMail.root@gallium.mathforum.org>...
> Could someone show a basic for loop that could produce the below results?
>
> L1.slope = [-59.3968 -56.9777 -54.7794 -51.587 -48.3138 -46.1093];
> L1.int = [571.9502 566.8451 560.12 550.4008 539.3366 530.5057];
>
> % LW is computed with above slope and intercept given measured windspeed.
> L1.a = L1.slope(1:1)*v+L1.int(1:1);
> L1.b = L1.slope(2:2)*v+L1.int(2:2);
> L1.c = L1.slope(3:3)*v+L1.int(3:3);
> L1.d = L1.slope(4:4)*v+L1.int(4:4);
> L1.e = L1.slope(5:5)*v+L1.int(5:5);
> L1.f = L1.slope(6:6)*v+L1.int(6:6);
>
> LW = [L1.a L1.b L1.c L1.d L1.e L1.f];

If you just need LW:

>>LW = L1.slope*v+L1.int;

Subject: for loop help

From: Sean

Date: 12 Mar, 2010 20:19:23

Message: 3 of 4

AMK <kennaster@gmail.com> wrote in message <1517414598.370865.1268421331497.JavaMail.root@gallium.mathforum.org>...
> Could someone show a basic for loop that could produce the below results?
>
> L1.slope = [-59.3968 -56.9777 -54.7794 -51.587 -48.3138 -46.1093];
> L1.int = [571.9502 566.8451 560.12 550.4008 539.3366 530.5057];
>
> % LW is computed with above slope and intercept given measured windspeed.
> L1.a = L1.slope(1:1)*v+L1.int(1:1);
> L1.b = L1.slope(2:2)*v+L1.int(2:2);
> L1.c = L1.slope(3:3)*v+L1.int(3:3);
> L1.d = L1.slope(4:4)*v+L1.int(4:4);
> L1.e = L1.slope(5:5)*v+L1.int(5:5);
> L1.f = L1.slope(6:6)*v+L1.int(6:6);
>
> LW = [L1.a L1.b L1.c L1.d L1.e L1.f];

If you just need LW:

>>LW = L1.slope*v+L1.int;

Subject: for loop help

From: AMK

Date: 12 Mar, 2010 20:25:55

Message: 4 of 4

Yep,
That works. Thanks!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com