How to plot dotted line drawings with imaginary number data?

I have a vector which have imaginary number,but I don't know how to plot it . If you know how to do could
you please help me . I would be thankf!!!
here is the data:
Nodes Directional Angle data
1 69 -0.22438-0.10101i
1 159 0.673+0.11673i
2 -115 0.54651+0.12031i
2 -25 0.5136+0.21753i
3 -159 0.65621+0.27459i
3 -69 0.46797-0.061048i
4 157 0.57602+0.23901i
4 -113 -0.37208-0.17589i
5 112 0.12365+0.0038796i
5 202 -0.48467-0.024974i

 Accepted Answer

I am not certain either, since I have no idea what the data mean,
Here are two possible apporoaches —
M = [1 69 -0.22438-0.10101i
1 159 0.673+0.11673i
2 -115 0.54651+0.12031i
2 -25 0.5136+0.21753i
3 -159 0.65621+0.27459i
3 -69 0.46797-0.061048i
4 157 0.57602+0.23901i
4 -113 -0.37208-0.17589i
5 112 0.12365+0.0038796i
5 202 -0.48467-0.024974i];
figure
hold on
for k = 1:max(M(:,1))
node = M(:,1)==k;
v = M(node,2:3);
plot(v(1,1), abs(v(1,2)), 's', 'DisplayName',sprintf('Node %d |1| = %.3f',k,abs(v(1,2))))
plot(v(2,1), abs(v(2,2)), 's', 'DisplayName',sprintf('Node %d |2| = %.3f',k,abs(v(2,2))))
text(v(:,1), abs(v(:,2)), compose(' %d',k), 'Horiz','left', 'Vert','middle')
end
hold off
grid
legend( 'Location','eastoutside', 'NumColumns',1)
figure
hold on
for k = 1:max(M(:,1))
node = M(:,1)==k;
v = M(node,2:3);
plot(v(1,1), rad2deg(angle(v(1,2))), 's', 'DisplayName',sprintf('Node %d \\angle 1 = %7.1f°',k,rad2deg(angle(v(1,2)))))
plot(v(2,1), rad2deg(angle(v(2,2))), 's', 'DisplayName',sprintf('Node %d \\angle 2 = %7.1f°',k,rad2deg(angle(v(2,2)))))
text(v(:,1), rad2deg(angle(v(:,2))), compose(' %d',k), 'Horiz','left', 'Vert','middle')
end
hold off
grid
legend( 'Location','eastoutside')
.

4 Comments

sorry, I didn't describe my question correctly. The data means the test point displacemen of a structure and I need to plot it in 3D. And here the data2 of the point at base which need to connect with the data aboved,data2:
Test point x y
1 -893.61210 -2336.42640
2 -2333.03550 -922.56490
3 -2327.56230 968.00810
4 -958.39450 2341.93880
5 1067.41320 2297.86560
6 2352.26620 929.65030
7 2335.49040 -950.34930
8 950.49370 -2316.09230
I am not certain what you want.
Try this —
M = [1 -893.61210 -2336.42640
2 -2333.03550 -922.56490
3 -2327.56230 968.00810
4 -958.39450 2341.93880
5 1067.41320 2297.86560
6 2352.26620 929.65030
7 2335.49040 -950.34930
8 950.49370 -2316.09230];
figure
stem3(M(:,2), M(:,3), M(:,1), 'filled')
% hold on
% YL = ylim;
% patch([xlim flip(xlim)], [YL(1)*[1 1] YL(2)*[1 1]], [1 1 1]*0.75, 'FaceAlpha',0.75)
% hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Test Point')
figure
plot3(M(:,2), M(:,3), M(:,1), '.-')
% hold on
% YL = ylim;
% patch([xlim flip(xlim)], [YL(1)*[1 1] YL(2)*[1 1]], [1 1 1]*0.75, 'FaceAlpha',0.75)
% hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Test Point')
Make appropriate changes to get the desired result.
.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Products

Release

R2018b

Community Treasure Hunt

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

Start Hunting!