Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: interpolation problem
Replies: 1   Last Post: Jan 20, 2013 1:48 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Derek Goring

Posts: 3,892
Registered: 12/7/04
Re: interpolation problem
Posted: Jan 20, 2013 1:48 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.