[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: printing mesh with unequal ranges

**From**: |
Ben Abbott |

**Subject**: |
Re: printing mesh with unequal ranges |

**Date**: |
Fri, 01 Apr 2011 08:29:35 -0400 |

On Apr 1, 2011, at 8:20 AM, Huub van Niekerk wrote:
>* Hi,*
>* *
>* I'm trying to plot a function along a meshgrid using x = 0 : 6 and y = 0 : *
>* 10, and e.g. function f = 2 * x * sin(2*pi*y) + 4 * x * cos(2*pi*y)*
>* I'm getting the error that the matrix A^b must be square. I understand that, *
>* but then how can I get what I want? Reading the documentation it only deals *
>* with 1 variable in the function. Can somebody please tell me what mistake I *
>* make?*
>* *
>* Thanks*
Is this what you'd like to do?
x = 0 : 0.1 : 6;
y = 0 : 0.1 : 10;
[x, y] = meshgrid (x, y);
f = 2 * x .* sin(2*pi*y) + 4 * x .* cos(2*pi*y);
mesh (x,y,f)
Notice the use of ".*" instead of "*"
Ben