The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Convert from symbolic to double
Replies: 1   Last Post: Mar 6, 2013 4:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Christopher Creutzig

Posts: 323
Registered: 2/24/09
Re: Convert from symbolic to double
Posted: Mar 6, 2013 4:20 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 01.03.13 16:41, Peter Novak wrote:
> Christopher Creutzig <> wrote in message <>...

>> [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).


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.