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**

Dismiss Notice

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

Loading...

Similar Threads for Matlab newbie |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

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