Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matrix dimensions don´t agree.

Subject: Matrix dimensions don´t agree.

From: Wagner Ramos

Date: 13 Dec, 2010 19:54:05

Message: 1 of 3

I´m trying to plot a 3D graph for a given 2-dimensional function.
I created a m-file just like this:


[x,y] = meshgrid(1:0.2:10, 1:0.2:10);

f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);

mesh(x,y,f)


But it was not successful, I got the error:


??? Error using ==> mrdivide
Matrix dimensions must agree.

Error in ==> Untitled2 at 5
f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);

Could anyone help me?

Subject: Matrix dimensions don´t agree.

From: Sean de

Date: 13 Dec, 2010 20:04:08

Message: 2 of 3

"Wagner Ramos" <wagner83@gmail.com> wrote in message <ie5tkt$f66$1@fred.mathworks.com>...
> I´m trying to plot a 3D graph for a given 2-dimensional function.
> I created a m-file just like this:
>
>
> [x,y] = meshgrid(1:0.2:10, 1:0.2:10);
>
> f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);
>
> mesh(x,y,f)
>
>
> But it was not successful, I got the error:
>
>
> ??? Error using ==> mrdivide
> Matrix dimensions must agree.
>
> Error in ==> Untitled2 at 5
> f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);
>
> Could anyone help me?

remember the ./ !
 f = (1000.*x + 10^4 + (4*10^9)./(x.*y) + (10^5).*y + (1.5*10.^5)*y)./(10^6);

-Sean

Subject: Matrix dimensions dont agre

From: Loren Shure

Date: 13 Dec, 2010 20:07:40

Message: 3 of 3


"Wagner Ramos" <wagner83@gmail.com> wrote in message
news:ie5tkt$f66$1@fred.mathworks.com...
> Im trying to plot a 3D graph for a given 2-dimensional function. I
> created a m-file just like this:
>
>
> [x,y] = meshgrid(1:0.2:10, 1:0.2:10);
>
> f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);
>
> mesh(x,y,f)
>
>
> But it was not successful, I got the error:
>
>
> ??? Error using ==> mrdivide
> Matrix dimensions must agree.
>
> Error in ==> Untitled2 at 5
> f = (1000.*x + 10^4 + (4*10^9)/(x.*y) + (10^5).*y + (1.5*10.^5)*y)/(10^6);
>
> Could anyone help me?

Guessing here - should you final *y be .*y ?


--
Loren
http://blogs.mathworks.com/loren/
http://www.mathworks.com/matlabcentral/newsreader/search_results?search_string=tag%3Afaq

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us