How to plot a function depending on 3 different vectors as mesh or surface
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hazim Nasir
am 7 Aug. 2018
Kommentiert: Hazim Nasir
am 7 Aug. 2018
hello How I can plot the function f as a mesh or surface thanks for any help
d = 0.1;
a = 0.7;
t1 = -20:1:20;
t2 = -20:1:20;
t3 = -20:1:20;
t4 = -20:1:20;
x = cosd(t1).*(d.* sind(t2+t3+t4)+a_2 .*cosd(t2)+a* cosd(t2+t3));
y = sind(t1).*(d.* sind(t2+t3+t4)+a_2 .*cosd(t2)+a.* cosd(t2+t3));
z = a.* sind(t2) - d.* cosd(t2+t3+t4) + a.* sind(t2+t3) ;
f = sqrt(x.^2 + y.^2 + z.^2);
0 Kommentare
Akzeptierte Antwort
KSSV
am 7 Aug. 2018
d = 0.1;
a = 0.7; a_2 = 0.9 ;
t1 = -20:1:20;
t2 = -20:1:20;
t3 = -20:1:20;
t4 = -20:1:20;
x = cosd(t1).*(d.* sind(t2+t3+t4)+a_2 .*cosd(t2)+a* cosd(t2+t3));
y = sind(t1).*(d.* sind(t2+t3+t4)+a_2 .*cosd(t2)+a.* cosd(t2+t3));
z = a.* sind(t2) - d.* cosd(t2+t3+t4) + a.* sind(t2+t3) ;
[X,Y,Z] = meshgrid(x,y,z) ;
% f = sqrt(x.^2 + y.^2 + z.^2);
F = sqrt(X.^2 + Y.^2 + Z.^2);
figure
hold on
for i = 1:41
surf(X(:,:,i),Y(:,:,i),Z(:,:,i),F(:,:,i))
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!