At last Matlab do it!!!
Useful tool to plot a 3D implicit surface defined in cartesian coordinates. You can give f(x,y,z) = 0 as a string or as a function handle. Type <help ezimplot3> for usage. Remember to leave your comments and ratings...Thanks!
Nice function. I have an spectrum problem which yields the following equation
0=sin(kx/2)*sin(ky/2)*sin(k*(1-x-y)/2)*(sin(k/2)-sin(kx/2)*sin(ky/2)*sin(k*(1-x-y)/2))
It have multiple solutions and I want to display the figure so that you can distinguish between the different levels (surfaces) of solutions.
I also have restrictions that cannot be satisfied by your function. I have x+y+z(x,y)=1. x≤y≤z.
Can you help me solve these two problem
In other words x and y takes values on the triangle limited by
Very nice. I think it would be a great favor to the community, though, if you would generalize it so that when you already have a function handle, it doesn't require the Symbolic Toolbox. This is very easy to do by circumventing fix_fun as follows
if ~isempty(which('syms'))
[f_handle f_text] = fix_fun(fun); % f_handle is the anonymous f-handle for "fun"
% f_text is "fun" ready to be a title
elseif isa(fun,'function_handle')
f_handle=fun; f_text='';
else
error 'Cannot process input function'
end
Other minor remarks:
1. The syntax ezimplot3(fun,domain, color) does not parse correctly
2. You have a missing % in your help text, making about half of it disappear when doing help/doc ezimplot3
Dear Gustavo,thank you for your useful function.I tried to use it for plotting my own equation but it gives many surfaces together although i need only one surface around first root of my equation.Please can you help me how can i find it?
my equation is:
Nice code! Well done!
You should try to combine it with the implicitplot3d(.)[go this website http://www-users.math.umd.edu/~jmr/241/surfaces.html].
It realy gives an excelent visual result as an alternative to the cranky mesh from isosurface(.) :S.
%% ____________________________________
figure,
syms x y z;
h=x^2+y^2+z^2;
implicitplot3d(h, 1, -3, 3, -3, 3, -3, 3, 40); axis equal
hold on
ezimplot3(h-1,[-5 5])
This seems like a good function. However, I could not discover it since my time has been fruitlessly spent. This function requires the symbolic toolbox, yet no mention of this was explicitly included on this page or in the function help.
thank you for your function. I am trying to plot an implicit function coded into an m. file. However i get an error and i think this is due to the fact that my function contains some "if condition". So I get the error at line 168 of ezimplot3:
f_sym = eval([fun,'(x,y,z)']); % evaluating FUN at the sym point (x,y,z)
hi Gustavo,
I tried plotting the way you suggested.
h1=ezimplot3(M1,[0.02 5 0 4 0 0.35]);
where M1 is the determinant of a matrix involving the three variables alpha,gamma,R.
I got the following error:
"??? Error using ==> ezimplot3 at 82
FUN must have no more than 3 arguments"
To make sure i dont have more than 3 unknowns, i substituted specific values for each and got a single value for my Function M1.
Is is possible that i could send you my code of generating M1 and maybe you could help me.
Problem is my function M1 is not a simple function. Its a determinant of a matrix of order 8. Some of the terms in my matrix is polynomial fit of alpha and R. So the determinant is one crazy looking expression. Matlab cant output my entire determinant value (out of line limit error).
Hi...
*fun can be a string, an anonymous function handle, a .M-file handle, an inline function or a symbolic function. Any other variable present at the function (aside from alpha, gamma and R), must have a known value, that is, your function must depend only of alpha, gamma and R.
*>> domain = [min-alpha max-alpha min-gamma max-gamma min-R max-R];
ezimplot3(fun,domain);
I didn't understand you... so... have you already discovered the mistake? I was trying to do something about it, and that's what I've found:
> f = '(x/(4 - 3*y))^2 + (z/(4 - 3 *y))^2 -1';
> ezimplot3(f,[-3000 3000 -10000 10000 -3000 3000]);
It produces a nice graph... maybe the function that you provided is too small...
Regards!
Dave, as you should know, you only can see plots for explicit R2 to R functions, so the index "i" must be at most 2. Your function is also known as "Parabola", and has this other explicit (not implicit) form:
f(x,y) = x^2 + y^2 ... a paraboloid
I suggest that use instead the following command:
I'd like to study ezgraph3 throughly to make -ezimplot3- a "real command", and maybe some day, Mathworks could take it ;)
And...There's a way.... try writing:
>>help ezimplot3
for usage
This is fantastic! Just what I was looking for and what ezplot3 should do!
One questions/suggestion: Is there a way to also choose the color of the surface that's plotted? I was able to do it manually using the get/set commands, but I was hoping to be able to do it using the function directly.
Thanks for sharing this with the community.
Updates
12 Apr 2009
1.1
Better and corrected comments
Code easier to read
Now you can give it the name of your "function.m" file
A lot of input errors catched (I said "a lot", not "all") ;)
18 Apr 2009
1.2
*Now supports symbolic and inline classes as input
*Now you can pass it a 'color' argument
*Better comments
*Code was rearranged, so it would be more readable. One day ezimplot3 could connect with Matlab's "ezgraph3"
03 May 2009
1.3
-Cleaned some bugs up
-Now you can give an axis handle to make the plot
-Simplified code
07 Oct 2010
1.4
I've added information about the products required: Symbolic Math Toolbox