How to plot this function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Risposta accettata
Star Strider
il 2 Ago 2022
Force the NaN value at (0,0) to be 0 —
[X,Y] = ndgrid(linspace(-5,5,50));
Z = (X.^3.*Y - X.*Y.^3)./(X.^2+Y.^2);
Z(isnan(Z)) = 0;
figure
surfc(X,Y,Z)
colormap(turbo)
.
2 Commenti
Più risposte (2)
Sam Chak
il 1 Ago 2022
Think it should look like this:
[X, Y] = meshgrid(-0.5:1/40:0.5);
Z = X.*Y.*(X.^2 - Y.^2)./(X.^2 + Y.^2);
surf(X, Y, Z), xlabel('x'), ylabel('y'), zlabel('f(x, y)')
3 Commenti
Walter Roberson
il 2 Ago 2022
[X, Y] = meshgrid(-0.5:1/40:0.5);
Z = X.*Y.*(X.^2 - Y.^2)./(X.^2 + Y.^2);
Z(X==0 & Y == 0) = 0;
surf(X, Y, Z), xlabel('x'), ylabel('y'), zlabel('f(x, y)')
Abderrahim. B
il 1 Ago 2022
Hi!
Since you need to multiply by the truth, maybe this below:
f = @(x,y)((((x.^3).*y - x.*(y.^3)) ./ (x.^2 + y.^2) ).*( x ~= 0 & y~=0) + 0.*( x == 0 & y == 0))
[X, Y] = meshgrid([1:.5:10], [0:.1:10]);
F = f(X, Y) ;
surf(X, Y, F)
colorbar
Hope this helps!
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!