How do I go about plotting this function in MATLAB?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
smys x; smys y; f = (1 / 2*pi*sqrt(3)) * exp((4*x*x - 8*x + y*y + 2*x*y - 2*y + 4) / 3); plot(f);
It is just going to be on an x-y plane with a range of [-3, 3] and a domain of [-3, 3].
0 commentaires
Réponses (1)
Niels
le 10 Jan 2017
Hi Paul,
first of all, there is no need to use syms if you just want to create a function.
you can use function handle and create an anonymus function: (in addition i think you got something wrong in your function, or it wont do as you desire
look at
(1 / 2*pi*sqrt(3)) = 1/2 * pi * sqrt(2)
i guess you want
1 / (2*pi*sqrt(3)) = 1/2 / pi / sqrt(2)
create the function f(x,y), the dots are necessary (read about function handles and anonymous functions
f = @(x,y) 1 ./ (2*pi.*sqrt(3)) .* exp((4*x.*x - 8*x + y.*y + 2*x.*y - 2*y + 4) ./ 3);
now you need to set the interval in which the function shall be plotted
x=linspace(Start,End,NumberOfPoints);
y=linspace(Start,End,NumberOfPoints);
plot(x,y,f(x,y))
0 commentaires
Voir également
Catégories
En savoir plus sur Line 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!