Home > Archive > Matlab > September 2006 > How to solve mpower error in matlab?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to solve mpower error in matlab?
|
|
| peipoh 2006-09-29, 4:13 am |
| Dear all,
I am trying to plot a 3-d Line equation using two equation that is
related. Below is the code i input,
below is the codes i input,
%************************************[co
lor=darkred]
T = sqrt (H^2 + 2*R^2 - 2*R^2*cos((2*pi/3)-X));
plot3(T,H,X);
axis square;grid on
%************************************
but i got this error message...
??? Error using ==> mpower
Matrix must be square.
can anybody help to fix this problem?..thanks
Yours Sincerely,
Peipoh
| |
| Roger Stafford 2006-09-29, 4:13 am |
| In article <ef42700.-1@webcrossing.raydaftYaTP>, peipoh <hppoh@yahoo.com> wrote:
> Dear all,
>
> I am trying to plot a 3-d Line equation using two equation that is
> related. Below is the code i input,
>
>
> below is the codes i input,
> %************************************
> T = sqrt (H^2 + 2*R^2 - 2*R^2*cos((2*pi/3)-X));
> plot3(T,H,X);
> axis square;grid on
> %************************************
>
> but i got this error message...
> ??? Error using ==> mpower
> Matrix must be square.
>
> can anybody help to fix this problem?..thanks
>
> Yours Sincerely,
> Peipoh
----------------------------
Matlab doesn't like the "H^2" in the line where T is created. The
expression H^2 means the same thing as the matrix product H*H which would
require that H have the same number of columns as rows, but your H is a
vector with only one row. I think you need "H.^2" there which means
element-wise squaring, quite different from matrix squaring.
Roger Stafford
|
|
|
|
|