Hi, I am new to matlab and working on a project for school that is

due the 16th. Unfortunately some of the data clipped and the info I

need is at the peak. Is there a way to get an educated guess where

that peak may be? Mary Jo

Hi, I am new to matlab and working on a project for school that is

due the 16th. Unfortunately some of the data clipped and the info I

need is at the peak. Is there a way to get an educated guess where

that peak may be? Mary Jo

due the 16th. Unfortunately some of the data clipped and the info I

need is at the peak. Is there a way to get an educated guess where

that peak may be? Mary Jo

I'd suggest that you interpolate the

clipped points, replacing them with a

new value imputed from the non-clipped

data. It will work best if the clipping

is internal to the data, so that you

have some valid information on each

end of a clipped region.

If the clipping is at the end of your

data, intelligent extrapolation is a

far more difficult problem. For example,

x = 0:.1:3;

y1 = sin(x);

% clip

y1 = min(y1,0.9);

plot(x,y1,'o-')

You can form a decent estimate of where

the maximum truly resides from the above

data. I'd probably fit it with a cubic

spline or use my own inpaint_nans to do

the interpolation. Inpaint_nans is on

the file exchange. In case you are

interested, look here:

< http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4551> ;

The spline is simplest here though.

Then use fminbnd to find the max. Your

code might be like this:

% find the un-clipped points

k = (y1 < 0.9);

% fit the spline

spl = spline(x(k),y1(k));

% interpolate

ypred = ppval(spl,x);

% and plot

plot(x(k),y1(k),'ro', ...

x(~k),y1(~k),'gx', ...

x(~k),ypred(~k),'b+')

Having interpolated the clipped

information, fminbnd can find the

maximum value. Use it to minimize

a function like

fun = @(x) -ppval(spl,x);

fminbnd(fun,0,3)

ans =

1.5694

Since the true peak happens at

pi/2, this is reasonably close.

Had the all happened at an end of

your data, all is different, and

much more difficult to do well.

For example,

x = 0:.1:3;

y2 = exp(x);

clipval = 12;

y2 = min(y2,clipval);

k = (y2<clipval);

plot(x(k),y2(k),'go',x(~k),y2(~k),'rx')

Extrapolation is more difficult to

do well. Splines are not good at it.

I'd be best off here to fit a well

chosen model to my data, then use it.

HTH,

John

Mary Jo skrev:

Generally speaking: No.

Getting the dynamic range of the setup right is essential

in data acquisition, and lots of effort goes into getting

that right. Once the sensors saturates, amplitude information

is irreversably lost.

Rune

Similar Threads

1. clipping all data located behind the camera position even when the data is seen from different point

Hi, I am using campos and camtarget to define the viewing axes and volume, whenever these these two properties are reset, the whole scene will be rotated and traslated in the way that the viewing axis is perpendicular to the screen, and only the part of scene which is out of the view volume will be rendered, but when I rotate the scene, I can still see all of it. what I want is that whenever I rotate the scene, or look at it from top, I only see the part which is infront the camera and clip whatever located behind that camera position. Could any one help? thanks in advance Iman

2. convert colour video clip to B/W video clip - MATLAB

Okay, I have a question for the group: I've got a A/D converter pulling data from one of our instruments, and we're reading it in over the serial port. The data is all 8-bit unsigned int, range 0-255 inclusive.... I'm dealing with vectors that contain between 1 and 2 million samples total. *However*, due to an issue in the A/D converter, we're getting repeated 'spikes', of sorts, about every 2000 samples. If we subtract 127 from each element of the data vector (to recenter it around zero), the meaningful part of the signal is generally confined between +/- 50. My question is this: is there an elegant, vectorized way of setting any element outside that range to zero? Right now, we're doing the brute-force forloop method, but we'd like to expand to 5 million data points in the vector, and any time we save would be a benefit. Thanks for your time, and replies to the group-- email address goes nowhere. - Bill Blum, Wright State Univ.

4. Question 'clipping' data - MATLAB

5. clip 3D surface according to X Y coordinate?

Hi, I am relatively new user of Matlab and have been searching and searching for a way to clip a 3D surface (produce by surf from a matrix) to specific X Y coordinates. The Z values correspond to genetic distance values and the X Y coordinates to actual geographic locations. I need to clip the surface so that it represents the values only across the sampled region (which is irregularly shaped). I saw a past thread concerning how this can be done along the Z axis, but nothing along the lines of C Y points. It seems to me this might be a common need, but so far no luck. Can anyone recommend a function or approach? Thank you!

OK, hoping there is a way to do what i'm trying to do... I'm drawing 3D surface which covers the theoretical limits of operation for a component. Lets assume that the original X,Y,Z matrix is rectangular, and Z is Power. I now want to apply practical constraints to this same plot...say, not being able to run when power is greater than A or less than B. The easy way is to work through the array, and make Z=0 when A>Z<B. But, the surface plot then draws a surface at zero and color codes accordingly. Additionally, if the data point adjacent to the zero is significantly different the plot shows as a cliff or wall-like ledge with a flat plane a the zero point... I can't resize the array, because the constraints maybe crossed anywhere. Is their a way to clip a mesh?. Say, plot all points where Z not equal to 0, but not have it interpolate between zero and the adjacent value? Thanks in advance.