[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In this example code, I can't get interpl or spline to produce outpu
From: |
Ben Abbott |
Subject: |
Re: In this example code, I can't get interpl or spline to produce output, whats wrong? |
Date: |
Tue, 03 Apr 2012 17:52:40 -0400 |
On Apr 3, 2012, at 5:41 PM, Mark Lytle wrote:
> Hi all,
>
> Here is the code I am testing with:
>
> x=[0,.11,.15,.18,.25,.32,.35,.39,.42,.44,.48,.50];
> y = [0 , 1 , 3 , 5 , 12 , 10 , 9 , 7 , 5 , 3 , 7 , 10];
> figure(1)
> plot(x,y);
>
> x1=linspace(0,5,-.05);
>
> y1 = spline(x,y,x1)
> figure(2)
> plot(x1,y1);
> axis([0, .5, 0, 15])
>
> y2 = interp1(x,y,x1)
> figure(3)
> plot(x1,y2);
> axis([0, .5, 0, 15])
>
> I do get plots for figures 2 and 3, but they are empty.
>
> Scratching my head...How do you interpolate randomly spaced data?
>
> Any help is appreciated...
>
> Thanks,
> Mark Lytle
> Houston
x1=linspace(0,5,-.05)
x1 = 5
Your syntax for linspace is wrong. Take a look at "help linspace"
Ben