Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
curve fitting issue

Subject: curve fitting issue

From: Tazmusica

Date: 22 Sep, 2011 02:32:28

Message: 1 of 1

I am trying to fit some NMR data. The spectrum produced by the NMR is a sum of Lorentzians, and can be fit to the appropriate function. I have managed to fit a number of spectra using a separable least squares program I have written based on information in MatLab Central and some books on optimization. However, it seems that the curve fitting does not always fit peaks that are small, but clearly present (by visual inspection of the spectrum), even when the noise in the spectrum is quite small. Are there any suggestions as to what can be done to make the fit more sensitive so that these peaks are fit as well as the larger ones? Are there other algorithms? Below is the code for the separable leas squares program. Thanks for the help!

function[NLP,LP,res]=seplstsq(funlist,start_point,xdata,ydata,options)
 
 
function [sse,LP,res]=seplstsq_sse(NLP)
    DM=zeros(length(ydata),length(funlist));
    
    for ii=1:length(funlist);
        findx=funlist{ii};
        term=findx(NLP,xdata);
        DM(:,ii)=term(:);
    end
    
    LP=DM\ydata;
    res=DM*LP-ydata;
    sse=sum(res.^2);
    
end
 
NLP=fminsearch(@seplstsq_sse,start_point,options);
[crap,LP,res]=seplstsq_sse(NLP);
 
end

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us