- #1
arizonian
- 18
- 2
I have homework due and no help from the TA's due to a language problem.
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
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