08 August 2017 2 9K Report

I have a signal, and I want to add a plateau (Flattening) in my signal where ever I find local maxima.

What I am Doing:

I have 2 signals. 1st Reference and 2nd Measured Signal from Sensor. (I have taken 6 different measurement signals from 1 sensor).

The measured signals have delay, offset, flattening in it.

I want to make my reference signal to look alike my measured signal by putting delay, offset and flattening in signal to fulfill my needs.

I have done with delay and offset. The only problem I am facing is in Flattening.

To do flattening in my original signal I have observed that at every local maxima I have got flattening in signal and in every measurement flattening it is different.

So I want to make my signal flat at every local maxima.

Y axis: Height of flattening (I want to control the height of flattening at y axis)

Means I want to make a loop which contains varying values of flattening at y axis e.g In first attempt I want to give flattening of 0.1 then in 2nd attempt want to give flattening to al local maximas of 0.2 and observe their effect.

In short when I have local maxima so I want to give a flattening of (locs – 0.1) in the maxima on y axis. Means if I am getting peak at 5 so I want to give flattening at (5-0.1) at 4.9.

Then in 2nd loop want to check the effect of (locs-0.2) in the local maxima on y-axis.

Want to apply loop for values from 0.1 to 0.9.

X-axis: Width of flattening (I want to change the width of flattening)

Means I want to observe the effect of change in width of flattening by giving a range of values. This can be done by the help of loop.

In short when I have local maxima so I want to give a flattening width of 0.1 in the maxima on x axis.

Then in 2nd loop want to check the effect of 0.2 width change in the local maxima on x-axis.

Want to apply loop for values on x axis also for certain range.

Original Data Details :

In my original data x axis contains values in decimals so don’t want to interpolate data.

In my original data y axis also contains values in decimals.

size of my real data is 1x1666520.

Window effect:

The window is just to observe the behavior of change occurred at place of maxima means like if width of flattening is 0.1 so window is about 0.2.

I am sorry I remained unable to provide a good example data that explains exactly my situation in MATLAB so I have attached a handmade sketch.

I hope that I remained capable enough to make my question clear.

Below are the attached figures for explanation of flattening and How my Original signal looks like.

I am using MATLAB platform .

I am also attaching a rough example code on random data just to explain the concept  though it is not mature enough and not correct but it will provide an idea what i have done uptill now to achieve the results.

                t = 1:0.1:25 ;

                A = [1 0 1 2 3 5 0 1 0 0 0 2 3 6 7 0 0 8 0 1 1 2 3 4 2];

                [pks,locs] = findpeaks(A)

               % A(A>locs)=locs

               win1 = hamming(numel(A))';

               xw1 = win1.*A;

              figure

              plot(t,A,'b')

              A(locs+1) = A(locs);

              A(locs-1) = A(locs);

              hold all;plot(t,A,'r');

This is just my approach towards solving the problem which is just ok . If someone has a different approach so please share.

Thanks a lot in advance for your time and valuable and mature comments.

Similar questions and discussions