How to create a 3D plot from 2D set of data .

1 回表示 (過去 30 日間)
Nasir Qazi
Nasir Qazi 2013 年 11 月 17 日
回答済み: Faisal Khan 2018 年 4 月 25 日
%I have a data set
x1 =[ 0 0.12780 0.2145 0.2761 0.3211 0.354 0.379 0.396 0.409 0.417 0.421 0.421 0.417 0.412 0.406 0.394];
x2 = [0 0.025 0.050 0.075 0.100 0.125 0.150 0.175 0.200 0.225 0.250 0.275 0.300 0.325 0.350 0.375];
y=[31.117 37.28 43.13 48.67 53.90 58.840 63.450 67.740 71.740 75.390 78.720 81.680 84.240 86.090 87.230 87.880 ];
% if I plot normally
plot(x1,y); hold on
plot(x2,y);hold off
% attach is the picture
% but how can I plot 3D using this data?
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 17 日
Precise x, y and z coordinates
Walter Roberson
Walter Roberson 2013 年 11 月 18 日
So that we can understand what you are trying to do:
For the first line, please indicate what the x, y, and z coordinates should be for the first two points.
For the second line, please indicate what the x, y, and z coordinates should be for the first two points.

サインインしてコメントする。

回答 (2 件)

Roger Stafford
Roger Stafford 2013 年 11 月 17 日
編集済み: Roger Stafford 2013 年 11 月 17 日
Assuming that when you say "3D" you mean that x1 and x2 are along axes in different dimensions, then do:
plot3(x1,x2,y)
If by any chance you mean that the two curves are to be plotted as a single continuous curve, then do:
p = length(y):-1:1;
plot([x1,x2(p)],[y,y(p)],'y-')
  1 件のコメント
Nasir Qazi
Nasir Qazi 2013 年 11 月 18 日
編集済み: Nasir Qazi 2013 年 11 月 18 日
% with plot3(x1,x2,y)I come up with the following result , though I am looking for two line but it only one line.
% Secondly I am seeking for something like a surface plot. but I don't really know how can I do that .

サインインしてコメントする。


Faisal Khan
Faisal Khan 2018 年 4 月 25 日
why not try hold on command to get both the curves on the same figure

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by