help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing mesh with unequal ranges


From: Huub van Niekerk
Subject: Re: printing mesh with unequal ranges
Date: Fri, 1 Apr 2011 16:05:30 +0200

On Fri, Apr 1, 2011 at 2:29 PM, Ben Abbott <address@hidden> wrote:
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 "*"

Ok, thank you. This works. Now, after this function I try this one:

f = exp(-((x .- 6 / 3)^2)) * sin(2 * pi * y / 10);

Instead of ".*" it has ".-". The "A must be square" message is directed at the "=" sign. As far as I can see from the docs, this function should be no problem. What could be wrong here?

Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]