I have homework due and no help from the TA's due to a language problem.(adsbygoogle = window.adsbygoogle || []).push({});

How do you multiply a scalar with a matrix? It seems so simple, but I keep getting errors, such as "matrix must be square".

.m funtion code:

function X=parabola(a,x,b)

X=(x*a+b)^2;

Command window code :

EDU>> x=0:10:100;

EDU>> a=2;

EDU>> b=4;

EDU>> f=parabola(x,a,b)

??? Error using ==> mpower

Matrix must be square.

Error in ==> parabola at 2

X=(x*a+b)^2;

EDU>>

so now we try

EDU>> f=parabola(x',a,b)

??? Error using ==> mpower

Matrix must be square.

Error in ==> parabola at 2

X=(x*a+b)^2;

EDU>>

I know it can't be that hard, but the help section does not address this explicitly, and I have not been able to use logic to find out where I am going wrong. By the way, this is Matlab 7.0, Student version.

Thank You

Bill

**Physics Forums - The Fusion of Science and Community**

# Matlab newbie

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

- Similar discussions for: Matlab newbie

Loading...

**Physics Forums - The Fusion of Science and Community**