Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Graphically add or nonlinear rescale
Posted:
Nov 12, 2012 12:01 AM
|
|
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
Hi,
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?
Peter
|
|
|
|