create a surface plot from multiple 2d plots

2 ビュー (過去 30 日間)
Ahmed Hamdy
Ahmed Hamdy 2015 年 10 月 25 日
回答済み: Gareth Thomas 2015 年 10 月 25 日
hi all, i am a matlab beginner, and i needed help in this program. i have a parabola with certain parametrs, and i need to plot this same parabola 13 times to create a 3d surface, and then i add 13 points on the plot. i searched, and i was able to achieve this, but using plot3, which just plots the 13 parabolas separately and not as a 3d surface here is what i have done
clear
clc
load('D:\id.mat')
load('D:\cr.mat')
load('D:\xc.mat')
x1=xc(1,:); %contains 13 points each point will be plotted against each of x2
x2=xc(2,:); %contains 13 points
crx=cr(1,:);
cry=cr(2,:); %parabola to be plotted 13 times
y=-7:((6+7)/2055):6;
x=0:(0.06/13):0.06;
ymat=repmat(y,1,13);
xmat=repmat(x,numel(ymat),1);
zmat=[cry cry cry cry cry cry cry cry cry cry cry cry cry];
plot3(xmat,ymat,zmat,'k')
grid
hold on
plot3(x(1:13),x1,x2,'-b*')
xlabel('Time')
ylabel('x1')
zlabel('x2')
hold off

回答 (1 件)

Gareth Thomas
Gareth Thomas 2015 年 10 月 25 日
% y = a*x*x + b*x + c
x = -5:.1:5;
a = -5:5;
b = -5:5;
y = a'*(x.*x)+b'*x;
surf(y);

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by