John W. Eaton wrote:

>

> On 28-Feb-1997, Dave Comer <

[hidden email]> wrote:

>

> | Can anyone tell me the Octave quivalen of the following (valid)

> | Matlab statement:

> |

> | dydx = [ 1, dydx ];

> |

> | dydx is a 120 x 1 element array. The idea is to add one element to

> | the array. When I execute this in octave I get the following:

> |

> | octave:29> size(dydx)

> | ans =

> |

> | 120 1

> |

> | octave:30> dydx = [1, dydx];

> | error: number of rows must match near line 30, column 12

> | error: evaluating assignment expression near line 30, column 6

>

> Are you sure this is valid in MATLAB?

No, I'm not. I'm reading through "MATLAB for Engineers" by

Biran and Breiner, where the following statement is made (p.44):

"To plot dydx together with y we must add an element; it is dy/dx

calculated at the point x=0, that is d(sin x)/dx at x=0. Type

>>dydx = [ 1, dydx ];"

I'm not sure if the authors are using MATLAB 3.5 or 4.0 as both

are mentioned in the into and no definitive statement is made.

The version isn't relavent, as I can see from your answer. Must be

a mis-print.

Thanks for setting me straight John!

Dave

> With 4.2c, I get:

>

> >> a = [1;2]

>

> a =

>

> 1

> 2

>

> >> [0,a]

> ??? All matrices on a row in the bracketed expression must have the

> same number of rows.

>

> >> [0;a]

>

> ans =

>

> 0

> 1

> 2

>

> This also works for Octave.

>

> jwe

--

-----------------------------------------

David M. Comer (KC5QNU)

Senior Test Engineer

Mass Storage Group

Philips Semiconductors

MS 55

9201 Pan American Freeway N.E.

Albuquerque, NM 87113

VOICE: (505) 822-7376

FAX: (505) 822-7659

E-MAIL: mailto:

[hidden email]
mailto:

[hidden email] (alternate)

WWW:

http://abqms1 http://www.rt66.com/dcomer-----------------------------------------