필터 지우기
필터 지우기

How to plot a function depending on 3 different vectors as mesh or surface

조회 수: 1 (최근 30일)
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);

채택된 답변

KSSV
KSSV 2018년 8월 7일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by