create a surface plot from multiple 2d plots

2 views (last 30 days)
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

Answers (1)

Gareth Thomas
Gareth Thomas on 25 Oct 2015
% 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);

Categories

Find more on Spline Postprocessing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!