Desired input signal generation based on input and measured output and expected output with data comparision

Dear matlab expert,
I have one small query regarding as in title mentioned ''Desired input generation". I am trying it since long with excel however it is manuel data analysis and taking so much time. It would be great if anyone can help me with matlab to do that.
Problem: I have a input signal vector (red) and measured output data vector (blue). i have expected output data vector (green) which i want to have by changing input signal parameters.
Currently, as shown in figure, red is input (projected), green is desired output and blue is measured output.With excel i am changing input parameters (such as with gauss sinus mathamtical formula) in that manner so that i can have desired output. Attached are my all data vectors.
My methodology is like: i am comparing acceleration (blue and green) with red (i have projected red here).
Input red curve i am trying to match to the max acceleration peak (measured data) point as shown in figure too.
  • first trial i select the same points of first half acceleration which match to the input red curve. and got good result with measurement
It works well but i want to make it automatic. I would be very thankful to you to support me.
Furthermore, i used in excel following mathematical equation:
Input voltage sinus: U(t)=∑i(Ai*exp(-(t-ti)^2/D^2)) i=1,2,3 [V] vs t [s] [m/s2] red curve
I have sampling rate for input: 8000 Hz.
and for measured output: 10000 Hz
thank you

1 Comment

Dear Matlab experts,
I would like to have your comments on my question. May be some hints will be also useful. Also, will be helfpful to know either Matlab can do this or not.
Thank you very much in advance

Sign in to comment.

 Accepted Answer

hello
so this my suggestion / code for you
i first didn't understood evrything, so first thing was to try time align the 3 data vectors ((see figure 1)
then I tried to do a fit in amplitude and time to regenerate th red curve (see figure 3)
NB : I changed your files extension from csv to txt and converted the comma decimal sperator to the dot so there is o more confusion with csv comma separated columns (otherwise your measured data are two columns of integers when imported in matlab)
everything is in the attachement including the function to find peaks
all the best

4 Comments

Dear Sir,
First of all Thank you very very much. Its great code.
Small question: In your suggested code input signal has lower minimum amplitude with compare to measured curve. Is it possible to built input similar to the measured curve amplitude or higher than it? As my input signal has all positive value however we can put but double axis as in excel which will see as offset like -30 and it reach 90V instead of 60 V which will be equal to the measured curve 60 m/s2 with compare first y-aixs. . as shown in attached images (RH- Input signal axis and LH:measured signal axis).
Also, is it possible to fit input signal peak to the next three peak of the measured signal? as we fit with starting three peak as shown in figure. Is it also possble to calculate dominant frequency of these curves?
as in excel i have tried to built signal with exact frequency of the measured signal and compared input and measured output starting points with each other to get best optimize input. I am sure matlab can optimize input signal better than excel.
I hope you undersood my query
Thank you very very much in advance
Hello Sir Matthieu,
I am trying it since a week but no success. Actually my goal is to automate parameter setting of input signal. Input parameters iterations loop to get best input which will be fit to the output for first three peak.
I found last three peaks are just resonance so I do not need to fit input for the next three peak of output.
Could you please help me
Thank you very much
hello
the code so far already matches the first 3 peaks between the red and blue lines (time alignment + amplitude match)
so what do you want to match more ?
Dear Sir,
Thank you very much for your reply. In my analyisis it is important to have a input (three peak max and min), similar to blue lines. However, currently i have limitation to have just positive values for input. Hence, i have placed it via two Y-axis as shown in figure. Is is possible to have flexible modification for the input parameters to increase and decrease max and min amplitude of the first three peak corresponding blue lines?. It will help me to experiment and get best acaustic.

Sign in to comment.

More Answers (1)

I have a similar problem. did you get the expected result?
https://www.mathworks.com/matlabcentral/answers/1610700-comparing-curves-to-an-original-signal

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!