How can I plot multiple 3d surface from three 4d matrices generated from ndgrid()

1 view (last 30 days)
How can I plot multiple 3d surface from three 4d matrices generated from ndgrid()
i1 =linspace(-90*pi/180,90*pi/180,10);
i2 =linspace(-10*pi/180,10*pi/180,10);
i3 =linspace(-12*pi/180,12*pi/180,10);
i4 =linspace(-90*pi/180,0*pi/180,10);
[L1,L2,L3,L4]=ndgrid(i1,i2,i3,i4);
%khaledts_x,khaledts_y,khaled_z are three function to transfer L1,L2,L3,L4 to x,y,z
x=khaledts_x(0,0,0,L1,L2,L3,L4);
y=khaledts_x(0,0,0,L1,L2,L3,L4);
z=khaledts_x(0,0,0,L1,L2,L3,L4);
surf(x,z,y);
but surf function can't plot it
  2 Comments
Roger Stafford
Roger Stafford on 16 Sep 2014
If you want help, you will have to divulge to us just how 'khaledt' works. We shouldn't have to guess at it. What rules does it use to make the transformation?
(I assume writing three copies of khaledts_x is an error. Otherwise x, y, and z would be identically equal.)
Dr. Khaled FOUDA
Dr. Khaled FOUDA on 16 Sep 2014
sorry the write code is
x=khaledts_x(0,0,0,L1,L2,L3,L4);
y=khaledts_y(0,0,0,L1,L2,L3,L4);
z=khaledts_z(0,0,0,L1,L2,L3,L4);
and an example of khaledts_x is
function [X] = khaledts_x(theta_s1,theta_s2,theta_s3,theta_1,theta_2,theta_3,theta_4)
L1= 0;
L2= 0;
d4= 3.24;
d5= 3.24;
X = ((((-(-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*sin(theta_1)+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*cos(theta_1)).*sin(theta_2)+cos(theta_s1).*cos(theta_s2).*cos(theta_2)).*sin(theta_3)-((-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*cos(theta_1)+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*sin(theta_1)).*cos(theta_3)).*cos(theta_4)+(-(-(-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*sin(theta_1)+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*cos(theta_1)).*cos(theta_2)+cos(theta_s1).*cos(theta_s2).*sin(theta_2)).*sin(theta_4)).*d5+(((-(-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*sin(theta_1)+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*cos(theta_1)).*sin(theta_2)+cos(theta_s1).*cos(theta_s2).*cos(theta_2)).*sin(theta_3)-((-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*cos(theta_1)+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*sin(theta_1)).*cos(theta_3)).*d4+(-cos(theta_s1).*sin(theta_s2).*sin(theta_s3)+sin(theta_s1).*cos(theta_s3)).*L2+(-cos(theta_s1).*sin(theta_s2).*cos(theta_s3)-sin(theta_s1).*sin(theta_s3)).*L1;
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!