The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Graphically add or nonlinear rescale
Replies: 4   Last Post: Nov 12, 2012 9:50 AM

Advanced Search

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

Posts: 41
Registered: 8/18/10
Re: Graphically add or nonlinear rescale
Posted: Nov 12, 2012 12:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/11/2012 8:03 PM, Nasser M. Abbasi wrote:
> On 11/11/2012 8:57 PM, Peter Mairhofer wrote:
>> Hi,
>> I have two non-linear functions f1 and f2, both with a non-linear
>> scaling vector x1 and x2.
>> When I use
>> plot(x1, f1); hold on;
>> plot(x2, f2, 'r');
>> MATLAB perfectly prints the two graphs, no matter that x1 and x2 have
>> different (nonlinear) structure (in particular, x1 and x2 are
>> logarithmic and have different lengths).
>> Now I want to add these functions. But I can't just add f1 and f2
>> because the lengths are different and the x-axis do not match.
>> Is there a way to rescale data or export the graphs with a given amount
>> of spacing and from/to range so that I can add them?
>> Thanks,
>> Peter


Thanks, but ...

> can't you just simply resample the data with smaller number
> of points so that it now has the same number of points as the
> larger one?

... x1 and x2 have a different scale. I.e., the sampling points of f1/f2
are not equally spaced but the spacing is given by the values in x1/x2.

> There are many ways to resample the data. You can either
> fit it to a function first, then sample the function. Or do
> it by interpolation.

plot implicitely interpolates the data points. Is there a function which
does exactly the same as plot but applied for a data vector?


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.