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: How to insert a vector between two arbitrary points of a matrix?
Replies: 4   Last Post: Dec 21, 2012 11:45 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
bartekltg

Posts: 31
Registered: 12/11/12
Re: How to insert a vector between two arbitrary points of a matrix?
Posted: Dec 13, 2012 12:56 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

W dniu 2012-12-13 18:28, Wojtek pisze:
> Thanks for your answer. Well, I would like the vector to fit between two
> points. It's length may be (and almost always it will be) changed to fit
> there. But how to change the size of a vector from N to M (M may be both
> bigger and smaller then N) without cropping it? Some interpolation is
> necessary. Do you have any ideas how this can be done?


new_Y = interp1(data_X, data_Y, new_X);
for linear interpolation, or

new_Y = interp1(data_X, data_Y, new_X, 'spline');
new_Y = interp1(data_X, data_Y, new_X, 'pchip');


If you want to calculate many (new_Y/X) for constant data,
use piecewise polynomial.

PP = interp1(data_X, data_Y, 'linear'/'spline'/etc, 'pp');
and ppval function.

bartekltg





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.