Hello all,
I have raw data (column B) and fit data (column A). I am wondering what fit was it?. Can anyone please have a look at the data and fit (graph) and clarify my doubt?. How do I perform it in MatLab?. Kindly help.

3 Comments

jonas
jonas on 3 Aug 2018
Edited: jonas on 3 Aug 2018
Looks more like a moving average filter than a fitted equation. Are you sure it's a fit?
A moving average filter goes over your data point-by-point and calculates an average within a range (window) from that point. See for example the MATLAB function smooth . Your fit does not look parametric in nature as it retains the noise (although damped out). More likely some type of filter.
Thank you Jonas. I will look into it.
jonas
jonas on 3 Aug 2018
No problem, I've put the comment in the answers section so that the question is flagged as answered. As stated, if you provide some data I could try to identify the method used (granted that it's one of the standard ones).

Sign in to comment.

 Accepted Answer

jonas
jonas on 3 Aug 2018
Edited: jonas on 3 Aug 2018

0 votes

Looks more like a smoothing filter than a fitted equation. Perhaps a moving average.
A moving average filter goes over your data point-by-point and calculates an average within a range (window) from that point. See for example the MATLAB functions movmean and smooth . Your fit does not look parametric in nature as it retains the noise (although damped out). More likely some type of filter.
Try smoothing your data with different methods, using the smooth function, and see if you can reproduce the results. If you provide data, I'd be willing to help.

7 Comments

Thank you Jonas, I would really appreciate it. Kindly find the attached sample data ( new revised) in excel spreadsheet format that I am trying to figure out. "Sheet 1" has all data. Kindly have a look at it and let me know. Thanks for your help.
jonas
jonas on 3 Aug 2018
Cannot quite figure it out. Is there some background that one should be aware of? Context? There is a lot of other data in that file that we are not using.
Devan Krishnamurthy
Devan Krishnamurthy on 7 Aug 2018
Edited: Devan Krishnamurthy on 7 Aug 2018
Thank you Jonas for looking at it. Okay I will make it simple now. I have attached a new and simple sample data now. Please find the attached data. Can you please let me know how to perform moving average and also Lorentz fit?. I really appreciate your help.
jonas
jonas on 7 Aug 2018
Edited: jonas on 7 Aug 2018
That's easier. You're going to need this function from fileexchange for the Lorentzian fit ( link ).
%%Import data
data=xlsread('Sample Data_MatLab.xls');
x=data(:,1);
y=data(:,2);
y=y(~isnan(x));
x=x(~isnan(x));
%%Moving average
w=100; %window
ym=smooth(y,w,'moving')
%%Lorentz
yl=lorentzfit(x,y)
figure;
h=plot(x,y,'-b',...
x,ym,'-r',...
x,yl,'-k')
h=legend(h,'data','moving average','Lorentz fit')
Thanks a bunch. This really helped.
One more help, can you please help me to calculate FWHM of the fit data?.
jonas
jonas on 7 Aug 2018
Edited: jonas on 7 Aug 2018
Full width of half max? I dont know what that means in this context.

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 3 Aug 2018

Edited:

on 7 Aug 2018

Community Treasure Hunt

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

Start Hunting!