필터 지우기
필터 지우기

Creating 3d surf from 2d map

조회 수: 14 (최근 30일)
Michal
Michal 2023년 6월 26일
댓글: Star Strider 2023년 6월 26일
I have plot of some data(engine charactertics), which is basically few matrixies with points of coordinates x,y plotted together.
I want to create a 3-D countour plot or surf where the Z-axis will be efficiency in % from 86 to 96 ant the X and Y axis will be the same as on the picture. I know that i can create double variable where each field will be havving number of percentages but it will be hard to map this huge variable by hand. Are there any ways to just turn this plot to 3D, so each contour will be on higher level?

채택된 답변

Star Strider
Star Strider 2023년 6월 26일
It would help to have the data.
That aside, the plot would go something like this (I got tired of all that typing, so there are just three levels) —
x = linspace(0, 6E+3, 250).';
eff86 = [2E+3*cos(2*pi*x/max(x))+3E+3 1E+2*sin(2*pi*x/max(x))+1E+2];
eff90 = [1.750E+3*cos(2*pi*x/max(x))+3E+3 0.75E+2*sin(2*pi*x/max(x))+1E+2];
eff94 = [1.50E+3*cos(2*pi*x/max(x))+3E+3 0.5E+2*sin(2*pi*x/max(x))+1E+2];
% eff95 = 1.75E+3*[cos(2*pi*x/max(x)) sin(2*pi*x/max(x))];
% eff96 = 1.50E+3*[cos(2*pi*x/max(x)) sin(2*pi*x/max(x))];
figure
plot(eff86(:,1), eff86(:,2))
hold on
plot(eff90(:,1), eff90(:,2))
plot(eff94(:,1), eff94(:,2))
% plot(eff95(:,1), eff86(:,2))
% plot(eff96(:,1), eff86(:,2))
hold off
grid
xlabel('Motor Speed (rpm]')
ylabel('Torque [Nm]')
figure
surf([eff86(:,1) eff90(:,1) eff94(:,1)], [eff86(:,2) eff90(:,2) eff94(:,2)], (ones(numel(x),3).*[86 90 94]))
xlabel('Motor Speed (rpm]')
ylabel('Torque [Nm]')
zlabel('Efficiency [%]')
colormap(summer(2))
colorbar
Make appropriate changes to get the result you want.
.
  댓글 수: 2
Michal
Michal 2023년 6월 26일
thank, need to update the order of the points in my data because the spae is strange but it wokrs just as i want it
Star Strider
Star Strider 2023년 6월 26일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Joe Vinciguerra
Joe Vinciguerra 2023년 6월 26일
It's not hard to map a constant to a new column. Just do this:
eff86(:,3) = 0.86;
eff90(:,3) = 0.90;
% ... etc.
Then plot in 3D like this:
plot3(eff86(:,1), eff86(:,2), eff86(:,3))
plot3(eff90(:,1), eff90(:,2), eff90(:,3))
% ... etc.
The contour3 function is also an option.
  댓글 수: 2
Michal
Michal 2023년 6월 26일
Yeah, the plot3 function works fine thank for that, but when trying to contour3 it creates an error that Z axis should be at least 2x2 matrix.
Additionally, I would also like to try some filled 3d plot similar to this cearted from double variable
Joe Vinciguerra
Joe Vinciguerra 2023년 6월 26일
Well, there are a lot of different options depending what you want the final result to look like. Here are some helpful resources:
Once you pick one, if you have trouble you can create a new question about a specific function.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by