How to a complex plot of three different variables ?
3 views (last 30 days)
Show older comments
Hi all,
I have this function,
k=[0.5 0.8];
F(x,y,z,k)=0.1*x*y+(k^2)*sqrt((1/x*y)^2+(2/z)^2)+3*z*y);
I am trying to plot this function in terms of three parameters for 2 values of k, k=0.5, 0.8; my ultimate goal is to find the optimal values for x,y and z for minimum F,
any help and hint in this?
0 Comments
Answers (2)
Walter Roberson
on 16 Oct 2016
Vectorize the code on the right side. Put it into an anonymous function of three four variables. Now create an anonymous function
Fv1 = @(x) F(x(1),x(2),x(3), k(1))
now you can
X0 = rand(1,3);
[x1,f1] = fminsearch(Fv1, X0)
and construct similar for k(2). Compare f1 and f2 to determine which k value leads to a better optimized value. Use x1 or x2 for the x, y, z values.
1 Comment
Image Analyst
on 16 Oct 2016
What is the value of z? If it's variable, then how do you expect to "plot" a function of 3 continuous variables? That would be like you're trying to model the temperature distribution in a solid at every single (x,y,z) point in the solid. You can't "plot" that. You'd have to do volume visualization of the solid volume, like isosurfaces or cutaway views. Or else you could do it for a few discrete values of z and use plot3().
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!