MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by pxg882
on 25 Jan 2013

Does anybody know why this code isn't running?

x = -4:4; y = [0 .15 1.12 2.36 2.36 1.46 .49 .06 0]; cs = spline(x,y); xx = linspace(-4,4,101); yy = ppval(cs,xx); plot(x,y,'o',xx,yy,'-');

I can't figure it out! Thanks.

*No products are associated with this question.*

## 3 Comments

## Matt J

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59872#comment_125058

Works fine for me.

## pxg882

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59872#comment_125072

Don't quite know what was going on there, yeah it does work fine. Sorry about that!

As an aside, I'm plotting the following but want the y-axis to start from 0. Is there a way to implement this into the code?

## pxg882

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59872#comment_125081

Figured it out.

No worries