Date: Jan 20, 2013 1:48 PM
Author: Derek Goring
Subject: Re: interpolation problem

On Monday, January 21, 2013 5:37:08 AM UTC+13, Pallav Mishra wrote:
> Matthew Argall <argallmr@gmail.com> wrote in message <9c970eaf-f381-4362-8f2c-7abb27242f56@googlegroups.com>...
>

> > > I am trying to use interp1 to create a linear interpolated hourly and half-hourly price series given the following information:
>
> > > Also, I would want to plot the before interpolation and after interpolation information in the same graph.
>
> >
>
> > Convert your time stamps into Julian Dates using the MatLab function juliandates. Then put your monetary numbers into an array.
>
> >
>
> > interpolated_money_values = interp1(money_values, my_times, desired_times);
>
> > plot(money_values, my_times, desired_times, interpolated_money_values);
>
> ...............................
>
>
>
> This is what I am doing (not a very nice looking code, and obviously erroneous)-
>
>
>

> >> money_values = [70,69,66,64,66,69,70];
>
> >> jd = juliandate(2012,9,6,8,0,0);
>
> >> kd = juliandate(2012,9,6,9,0,0);
>
> >> ld = juliandate(2012,9,6,20,0,0);
>
> >> desired_time = jd:kd-jd:ld;
>
> >> my_time = [juliandate(2012,9,6,8,0,0),juliandate(2012,9,6,9,0,0),juliandate(2012,9,6,12,0,0),juliandate(2012,9,6,15,0,0),juliandate(2012,9,6,16,0,0),juliandate(2012,9,6,19,0,0),juliandate(2012,9,6,20,0,0)];
>
>
>

> >> interpolated_money_values = interp1(money_values,my_time,desired_time);
>
>
>
> I am getting an error: Error using interp1 (line 257)
>
> The values of X should be distinct.


Try:
interpolated_money_values = interp1(my_time,money_values,desired_time);
you had the arguments arse about face.