Nonlinear curve fitting, how to ?
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Arsalan
      
 le 28 Juin 2014
  
    
    
    
    
    Réponse apportée : Arsalan
      
 le 28 Juin 2014
            Hi,
I have two nonlinear functions defining the response of a system in frequency domain
H(f;Y0,Z0)= Z / ((j*2*pi*f)+(j*2*pi*f*Y0)+Z0)
H(f;Y1,Z1)= Z / ((j*2*pi*f)+(j*2*pi*f*Y1)+Z1)
to see the difference in two responses in decibles I introduce S(f) as
S(f) = 20*log(H(f;Y1,Z1)/H(f;Y0, Z0))
I also have predetermined values for S(f) obtained from experimental work where in both cases f is a known vector.
My main aim is to find values for Y1, Z1, Y0, Z0 through optimization in order to fit
S(f) = 20*log(H(f;Y1,Z1)/H(f;Y0, Z0))
to my experimental readings
How can I best achieve this ?
0 commentaires
Réponse acceptée
  the cyclist
      
      
 le 28 Juin 2014
        If you have the Statistics Toolbox, you should be able to do this with the nlinfit() function.
4 commentaires
  the cyclist
      
      
 le 28 Juin 2014
				I expect you have a coding error. Those data look like they could be fit just fine with nlinfit, assuming you have the proper functional form defined.
Here is a very simple example of nlinfit:
rng(1)
% Here is an example of using nlinfit(). For simplicity, none of
% of the fitted parameters are actually nonlinear!
% Define the data to be fit
x=(0:1:10)'; % Explanatory variable
y = 5 + 3*x + 7*x.^2; % Response variable (if response were perfect)
y = y + 2*randn((size(x)));% Add some noise to response variable
% Define function that will be used to fit data
% (F is a vector of fitting parameters)
f = @(F,x) F(1) + F(2).*x + F(3).*x.^2;
F_fitted = nlinfit(x,y,f,[1 1 1]);
% Display fitted coefficients
disp(['F = ',num2str(F_fitted)])
% Plot the data and fit
figure
plot(x,y,'*',x,f(F_fitted,x),'g');
legend('data','fit')
Plus de réponses (1)
Voir également
Catégories
				En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




