Question about combining surf and plot3
古いコメントを表示
Hello all,
I would like to plot a 3D plot in which I plot some scattered 3D points and at the same time I would like to plot surfaces which correspond to the limits of the ranges of my three variables. I attach a .dat file which contains the variables, the variable 'parameters' contain the 3D data which to be plotted, they are 500 data points for each of the three variables. The variables p1, p2 and p3 contain the ranges of my three variables, I would like to plot the surfaces which correspond to the limits of these variables, for example for the third variable, this will do the job for the lower limit:
surf(p3(1)*ones(size(parameters,2),size(parameters,2)),'FaceColor','r','FaceAlpha',0.3,'EdgeColor','none')
I have a problem which is that after I use the command plot3 to plot the data as follows:
figure('units','normalized','outerposition',[0 0 1 1])
surf(p3(1)*ones(size(parameters,2),size(parameters,2)),'FaceColor','r','FaceAlpha',0.3,'EdgeColor','none')
hold on
plot3(parameters(1,:),parameters(2,:),parameters(3,:),'*r','MarkerSize',15)
hold on
plot3(parameters(1,IDEIM_mu),parameters(2,IDEIM_mu),parameters(3,IDEIM_mu),'ko','MarkerSize',20)
xlim([0.8*p1(1) 1.2*p1(2)]);
ylim([0.8*p2(1) 1.2*p2(2)]);
zlim([0.8*p3(1) 1.2*p3(2)]);
Then the first surface plot disappers. Could you please let me know how I could combine the two kind of plots ? Thanks.
2 件のコメント
My guess is your axis limits are not covering the surface plot. Comment them out and see if your surface plot is still there. If it is still there, you should adjust your axis limits
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
xDot = [8 6 1];
yDot = [2 12 16];
zDot = [.5 1 .8];
surf(X,Y,Z)
hold on
plot3(xDot,yDot,zDot,'r-*' )
hold off
Saddam N Y
2024 年 6 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


