Matlab 3 variable function plot

66 vues (au cours des 30 derniers jours)
Zeynab Mousavikhamene
Zeynab Mousavikhamene le 7 Mai 2020
Commenté : Ameer Hamza le 10 Mai 2020
The equation is:
bt1 to bt3 and b1 are all constants.
and I want to plot it in 3D. I tried a couple of functions like:
syms x1 x2 x3
but it retunrs nothing.
  6 commentaires
Zeynab Mousavikhamene
Zeynab Mousavikhamene le 8 Mai 2020
You are right I am plotting solution for f=0. I changed the interval and did not show anything.

Connectez-vous pour commenter.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 7 Mai 2020
fimplicit3 is used to plot implicit equations with three variables. What you have is 4D data (3 input variables, 1 output variable). You need to use a 4D visualization function, like slice(), to visualize your function. See this example
Beta(1)= -294449.131783462;
b(1) = 87293272725.0805;
f=@(x1,x2,x3) Beta(1).*x1+Beta(2).*x2+Beta(3).*x3+b(1);
[X1,X2,X3] = meshgrid(linspace(-1,1));
V = f(X1,X2,X3);
slice(X1, X2, X3, V, [-0.5 0.5], 0.3, 0)
shading interp
  4 commentaires
Ameer Hamza
Ameer Hamza le 10 Mai 2020
I haven't used zlim in my code in the comment. Have you tried running that code?

Connectez-vous pour commenter.

Plus de réponses (1)

Tommy le 8 Mai 2020
You can pick any interval. Your plot will only show something if solutions to f=0 lie within the interval. [0, 0, -b1/Beta(3)] is a clear solution. -b1/Beta(3) is on the order of 1e11, so how about this:
Beta(1)= -294449.131783462;
f=@(x1,x2,x3) Beta(1).*x1+Beta(2).*x2+Beta(3).*x3+b(1);
fimplicit3(f, [-5 5 -5 5 1e10 1e12])


En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by