Translating shape functions into isosurfaces, a new question

3 ビュー (過去 30 日間)
Brian
Brian 2012 年 10 月 29 日
Hey, all, thanks for reading this,
I am trying to create a set of isosurfaces defined by shape functions (kind of like CAD curves). My code for such is here: http://pastebin.com/80ZBXC4u.
What I can do is take a shape function for a sphere, for instance, and plot it as a isosurface pretty easily. When I try one of the equations for my example, however, it doesn't work. I am thinking it could possibly be a result of me not translating it right into MATLAB.
The line:
% our_function = @(x,y,z) (sqrt(x.^2+y.^2+z.^2)<10); % Example
is the sample code for the sphere. I then have the example:
% our_function = @(x,y,z) (z.*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0); % Shape Function 1 Simplified
which is a bit more convoluted. When I try to do this one, I get the error:
Error using * Inputs must be 2-D, or at least one input must be scalar. To compute elementwise TIMES, use TIMES (.*) instead.
which means somewhere I am multiplying a vector element instead of a scalar element (what I think, at least).
I then have the more advanced line, which I haven't even started yet:
% our_function = @(x,y,z) (z.*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0)&&(x.^2>0.01*15*15)&&(z>-2.3*15)
% Shape Function 1
% Extended
which is the last equation plus some constraints for x,y and z.
What this should plot is a 2D surface in 3 dimensions, meaning its a sheet of sorts. However, I cannot MATLAB well, so somewhere along the line I think I am inputting this wrong.
Thanks for all the advice you can give!
Actually, scratch this, I managed to solve it myself. I needed .*, and just one & for the constraints since it was a vector value.

採用された回答

Brian
Brian 2012 年 10 月 29 日
Actually, scratch this, I managed to solve it myself. I needed .*, and just one & for the constraints since it was a vector value.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScalar Volume Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by