Plotting data against a combination array
Mostrar comentarios más antiguos
I have created a combination array of two vectors ranging from -60 to +60 with increments of 1. I am assigning the first column of the combination matrix to X and the second column to Y. I am then looping through every combination of this array, and using the X and Y values to output my Z value, so for every unique combination of X and Y, I have a unique value for Z. I have tried doing a 3D plot, but am running into issues with the X and Y parameters because they are not linear. Any help is greatly appreciated!
alpha = 0;
L = 0.002;
W = 0.002;
x = 0;
y = 0;
h = 0.001;
thetaX_loop = -60:1:60;
thetaY_loop = -60:1:60;
combo = table2array(combinations(thetaX_loop,thetaY_loop));
Z = zeros(length(combo),4);
for i = 1:length(combo)
X = combo(i,1);
Y = combo(i,2);
deltaX = tand(thetaX)*cosd(alpha)*h;
deltaY = tand(thetaY)*cosd(alpha)*h;
A1 = (W-x-deltaX)*(L-y-deltaY);
A2 = (W+x+deltaX)*(L-y-deltaY);
A3 = (W-x-deltaX)*(L+y+deltaY);
A4 = (W+x+deltaX)*(L+y+deltaY);
Em = cosd(thetaX)*cosd(thetaY);
Z1 = A1*Em;
Z2 = A2*Em;
Z3 = A3*Em;
Z4 = A4*Em;
Z_tot = [Z1,Z2,Z3,Z4];
Z(i,:) = Z_tot;
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Polygons en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
