Thread Subject: Repetitive computations (Looping)

Subject: Repetitive computations (Looping)

From: Esuene SAMSON

Date: 7 Apr, 2008 09:55:04

Message: 1 of 10

Can someone help me with the following, please.

I am studying a model which requires the evaluation of four
parameters, namely, a,b,c and d. What I have done so far
has been to keep three of these parameters constant while
varying the 4th. I find this very boring and time-
consuming, and will like to automate the process, in such a
way that the input parameters are recorded also within the
array representing the output.

The parameters have the range:

a=3:10
b=0:15:pi
c=0:5:pi/2
d=5:5:pi/2

Thank you.

Esuene.

Subject: Repetitive computations (Looping)

From: us

Date: 7 Apr, 2008 10:00:05

Message: 2 of 10

"Esuene SAMSON":
<SNIP is not happy with his/her parameters...

> I am studying a model which requires the evaluation of
four parameters, namely, a,b,c and d.
> The parameters have the range:
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2

...but

% a = 3 4 5 6 7 8 9 10
% b = 0
% c = 0
% d = Empty matrix: 1-by-0

us

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:08:42

Message: 3 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
if I am solving the problem, I shall do the following
[A,B,C,D]=ndgrid(a,b,c,d);
A=A(:); B=B(:); C=C(:); D=D(:);
for i=1:length(A)
  % add your code here.....
end

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:08:47

Message: 4 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
if I am solving the problem, I shall do the following
[A,B,C,D]=ndgrid(a,b,c,d);
A=A(:); B=B(:); C=C(:); D=D(:);
for i=1:length(A)
  % add your code here.....
end

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:09:37

Message: 5 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
if I am solving the problem, I shall do the following
[A,B,C,D]=ndgrid(a,b,c,d);
A=A(:); B=B(:); C=C(:); D=D(:);
for i=1:length(A)
  % add your code here.....
end

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:10:04

Message: 6 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
if I am solving the problem, I shall do the following
[A,B,C,D]=ndgrid(a,b,c,d);
A=A(:); B=B(:); C=C(:); D=D(:);
for i=1:length(A)
  % add your code here.....
end

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:10:04

Message: 7 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
if I am solving the problem, I shall do the following
[A,B,C,D]=ndgrid(a,b,c,d);
A=A(:); B=B(:); C=C(:); D=D(:);
for i=1:length(A)
  % add your code here.....
end

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 10:13:01

Message: 8 of 10

"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <ftcr1o$4o0$1@fred.mathworks.com>...
> Can someone help me with the following, please.
>
> I am studying a model which requires the evaluation of four
> parameters, namely, a,b,c and d. What I have done so far
> has been to keep three of these parameters constant while
> varying the 4th. I find this very boring and time-
> consuming, and will like to automate the process, in such a
> way that the input parameters are recorded also within the
> array representing the output.
>
> The parameters have the range:
>
> a=3:10
> b=0:15:pi
> c=0:5:pi/2
> d=5:5:pi/2
>
> Thank you.
>
> Esuene.
also check your b,c,d vectors, the arguments seem to be in
wrong orders

Subject: Repetitive computations (Looping)

From: Esuene SAMSON

Date: 7 Apr, 2008 21:13:01

Message: 9 of 10

Hi, Dingyu Xue. I do not understand what you meant when you
said my arguments appear to be in the wrong order. Can you
explain, please. Thank you.

Esuene.

 

"Dingyu Xue" <xuedingyu@mail.neu.edu.cn> wrote in message
<ftcs3d$emc$1@fred.mathworks.com>...
> "Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
> message <ftcr1o$4o0$1@fred.mathworks.com>...
> > Can someone help me with the following, please.
> >
> > I am studying a model which requires the evaluation of four
> > parameters, namely, a,b,c and d. What I have done so far
> > has been to keep three of these parameters constant while
> > varying the 4th. I find this very boring and time-
> > consuming, and will like to automate the process, in such a
> > way that the input parameters are recorded also within the
> > array representing the output.
> >
> > The parameters have the range:
> >
> > a=3:10
> > b=0:15:pi
> > c=0:5:pi/2
> > d=5:5:pi/2
> >
> > Thank you.
> >
> > Esuene.
> also check your b,c,d vectors, the arguments seem to be in
> wrong orders

Subject: Repetitive computations (Looping)

From: Dingyu Xue

Date: 7 Apr, 2008 23:07:01

Message: 10 of 10

say, your
d=5:5:pi/2 command may generate an empty vector, the colon
expression should be:
d=start:step:end,
as I understand, in b=0:15:pi, pi should be the step, so it
should be placed in the middle
"Esuene SAMSON" <esuene.samson.nospam@example.com> wrote in
message <fte2ot$2i2$1@fred.mathworks.com>...
> Hi, Dingyu Xue. I do not understand what you meant when you
> said my arguments appear to be in the wrong order. Can you
> explain, please. Thank you.
>
> Esuene.

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