create a surface plot from multiple 2d plots

조회 수: 1 (최근 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 CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by