Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Help for my code
Replies: 2   Last Post: Apr 23, 2013 9:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Soloy Nanakassé

Posts: 1
Registered: 4/23/13
Help for my code
Posted: Apr 23, 2013 10:05 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I don't what's wrong with my code ??

%% Moindres carrés
global Nf Phi
Nf=[38; 44 ;100 ;110; 179; 206; 210 ;260 ;360 ;500; 560; 576; 660; 710; 800; 900; 1049 ;1100;...
1300; 1467 ;1549; 2100 ;2500; 2500; 2600; 3500 ;3600; 4000; 5000 ;5500 ;6000 ;7000;...
8000; 10000; 15900];

Phi=[0.9198 0.8987 0.5580 0.8369 0.5711 0.5785 0.5759 0.5553 0.5964 0.3214...
0.3107 0.2692 0.3223 0.3321 0.3179 0.3071 0.3021 0.3113 0.2944 0.2675...
0.3120 0.3185 0.1896 0.2067 0.1927 0.1841 0.1865 0.1805 0.1391 0.1871 0.2038 0.1320 0.1525...
0.1487 0.1310];

par=[1 2];
global af
af=1;
m=par(1);
k=par(2);
cst1= 1/(1-m);
cst2=af^(1-m)+n*(Phi./k)^m;
cst3=(Phi./k);
cst4=1+m^2;
cst5=af+Nf.*(cst3^m)*(af)^m;
%%Définiton de la fonction de distribution
function pn = f(n)
pn = ((af^(m))*exp(-LambdaA*(cst2^cst1))*LambdaA*(cst3^(2*m))*((cst2^cst1)^m)*(-m+LambdaA*(cst2^cst1)))/(cst4*cst5);
end
%%
function out = F(a)
out = sum ( (Phi-f(a,Nf)).^2 );
end

a0 = par; % correspond à B1, sigma1, x1, B2, sigma2, x2

% Appel de l'optimiseur. Attention aux '' autour de F

asol = fminsearch ( 'F', a0);

% (Facultatif mais en général utile)
% Superposition points experimentaux et fittés.

plot (xi, yi, '*', xi, f(asol, xi))



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.