Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Convert from symbolic to double
Posted:
Mar 6, 2013 4:20 AM


On 01.03.13 16:41, Peter Novak wrote: > Christopher Creutzig <Christopher.Creutzig@mathworks.com> wrote in message <5130A3FA.5070701@mathworks.com>...
>> [X,Y] = meshgrid(x_num, y_num); >> for h=1:n >> f = matlabFunction(subs(v_x_y(h), [x_1, x_2, y_1, y_2], ... >> [x_1_n, x_2_n, y_1_n, y_2_n]), ... >> 'vars', [x, y]); >> v_x_y = f(X,Y); >> % ... I assume you do something with v_x_y here, >> % or assign to v_x_y(h) otherwise. >> end
> x_1, x_2, y_1, y_2 are constants within one element
Does that mean the code above cannot work for you and is too different from what you need to adapt?
> Is it possible to create surf plot of function which is created with matlabFunction?
Sure. They're just ordinary function handles. (I don't like calling a function ?anonymous? after I've assigned it to a name like the f above ? it has a name. It's just not stored in a file, although you certainly could do that as well.)
> If I write > surf(x_num, y_num, f) > I get an error: Z must be a matrix, not a scalar or vector.
That's because surf doesn't accept functions. Either use ezsurf or surf(x_num, y_num, v_x_y).
HTH, Christopher



