MATLAB: Surf plot 3d – matrix multiplication

surfsurface

Hello,
could someone let me know how to get around this problem in the code.
i need to do the following: 1- plot the surf 2- multiply with RS matrix 3- make a new surf
angle1_min=0; angle1_max=pi/2; %all 8 Octant in 3d [0-2*pi]
angle2_min=0; angle2_max=pi/2;
number1=50; number2=2500; number3=51; %xlsread
[angle1, angle2] = ndgrid(linspace(angle1_min,angle1_max,100),linspace(angle2_min,angle2_max,100)) % size 100*100 (for using surf)
x= number1*sin(angle1)*sin(angle2)
y= number2*cos(angle1)
z= number3*sin(angle1)*cos(angle2)
surf(x, y, z) % works fine
mat = [x; y; z] % size mat here 300*100 (depend on angle size)
RS = [1 0 0; 0 1 0; 0 0 1] % size 3*3
new_mat = RS * mat % Matrix Multiplication is required- RS is to be kept
surf(new_mat)
i tried to use a function with for loop that return one point for mat with the size 1*3 then i multiplied it with RS matrix. at the end i plotted all the points using surf but its not what i expected.

Best Answer

rotate
Related Question