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 | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab newbie

**Physics Forums | Science Articles, Homework Help, Discussion**