Professional Documents
Culture Documents
64 Bits
2013-2014
Rpertoire des programmes internes:
C:\Program
Files\MATLAB\R2010a\toolbox\matlab\polyfun
Prof. Mr s.ACHAKIR
14 septembre 2014
1 ANALYSE
1.1 Oprations . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Traage de fonctions . . . . . . . . . . . . . . . . . .
1.3 Drivation . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Primitive . . . . . . . . . . . . . . . . . . . . . . . . .
1.5 Limites . . . . . . . . . . . . . . . . . . . . . . . . . .
1.6 Formule de Taylor . . . . . . . . . . . . . . . . . . . .
1.7 Division euclidienne des polynmes . . . . . . . . .
1.8 Oprations sur les polynmes . . . . . . . . . . . . .
1.9 Dcomposition en lments simples . . . . . . . . .
1.10 Rsolution exactedes quations diffrentielles . . . .
1.10.1 Equations diffrentielles du premier ordre .
1.10.2 Equations diffrentielles du second ordre . .
1.11 Rsolution numrique des quations diffrentielles
1.12 Inversion de fonction numrique . . . . . . . . . . .
1.13 Calcul dintgrales par commandes internes . . . .
1.13.1 trapz : mthode des trapzes . . . . . . . . .
1.13.2 quad : mthode de Simpson . . . . . . . . . .
1.13.3 quadgk : mthode de Gauss-Konrod . . . . .
2 ALGEBRE
2.1 Matrices . . . . . . . . . . . . . . .
2.1.1 Matrice uniligne . . . . . .
2.1.2 Matrice unicolonne . . . . .
2.1.3 Matrice carre . . . . . . . .
2.1.4 Matrice rectangulaire . . . .
2.2 Oprations sur les matrices . . . .
2.2.1 Somme . . . . . . . . . . . .
2.2.2 Multiplication scalaire . . .
2.2.3 Multiplication matricielle .
2.3 Transpose dune matrice . . . . .
2.4 Dterminant dune matrice carre .
2.5 Inverse dune matrice . . . . . . . .
2.6 Rsolution dun systme linaire .
.
.
.
.
.
.
.
.
.
.
.
.
.
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
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.
.
.
.
.
12
12
12
12
12
13
13
13
13
13
14
14
14
15
Topo-GREA
Mr Achakir
Chapitre 1
ANALYSE
1.1 Oprations
Lors de la dfinition dune fonction, il est prfrable dutiliser les oprations ./, ., .
pour que la fonction sapplique un tableau vectoriel et faire des oprations termes
termes.
Espace ou caractre blanc est dsign par :
Somme de n termes dune suite
for k=1 :10
x(k)=k ; end sum(x) ans = 55
sum(x(1 :10)) ans = 55
sum(1 :2 :10) ans = 25
Exemples dinsertion de fonctions
% Par la classe handle
syms x
f = @( x )( x. 2 + 3. x + ( x + 1)./(1 + x. 2)) ;
u=1 :0.1 :2 ;
v=f(u) ;
% Par la commande inline
syms x
f = inline( x.2 + 2. x + 3 )
f = Inline function : f ( x ) = x.2 + 2. x + 3
u=-3 :0.1 :3 ; v=f(u) ;
CHAPITRE 1. ANALYSE
1.3. DRIVATION
0.4
0.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1
0.5
0.5
Classe handle
f = @( x )( x. 2 + 3. x + ( x + 1)./(1 + x. 2)) ;
u=1 :0.1 :2 ;
v=f(u) ;
plot(u,v,rs)
Mupad
mupad
f := x 2 + 2 x + 3 plot( f ) plot( f , x = 9..3)
y
30
20
10
1.3 Drivation
Matlab
>> syms x
a >> f = 2. x. 3 ;
diff(f)
Topo-GREA
Mr Achakir
1.4. PRIMITIVE
CHAPITRE 1. ANALYSE
ans =6 x 2
b f=inline( 2. x. 3 )
diff(f(x)),diff(f(x),2)
c f = @( x )(2. x. 3) ;
diff(f(x)) ans =6 x 2
Mupad
f :=ln(x) diff(f,x) diff(diff(f,x),x)
1.4 Primitive
>>syms x c
a >> f = 3. x. 3 + x + 3 ; >> F=int(f)+c
F = c + ( x (3 x 3 + 2 x + 12))/4
b f = @( x )(2. x. 3) ;
int(f,x) ans =x 4/2
int(f(x)) ans =x 4/2
1.5 Limites
Matlab
>> syms x
a >> f = sin( x )./x ;
>> l=limit(f,x,0)
l =1
b f=@(x)(sin(x)./x) ; limit(f(x),0)
ans =1 Mupad
f := (sqrt(4 + x2 ) 2)/( x2 ) limit( f , x = 0)
CHAPITRE 1. ANALYSE
3)5 /5120 + O(( x 3)6 )
ln(1 + x ) =
x
4
( x 3)2
32
( x 3)3
192
( x 3)4
1024
( x 3)5
5120
+ o ( x 3 )5
Mr Achakir
CHAPITRE 1. ANALYSE
1.11. RSOLUTION NUMRIQUE DES QUATIONS DIFFRENTIELLES
Topo-GREA
Mr Achakir
CHAPITRE 1. ANALYSE
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
10
10
CHAPITRE 1. ANALYSE
Topo-GREA
ans = 9
11
Mr Achakir
Chapitre 2
ALGEBRE
2.1 Matrices
2.1.1 Matrice uniligne
A=[-1 2 -2/3 123]
ou A=[1, 2, 2/3, 123]
A = -1.0000 2.0000 -0.6667
123.0000
12
CHAPITRE 2. ALGEBRE
13
Mr Achakir
CHAPITRE 2. ALGEBRE
14
CHAPITRE 2. ALGEBRE
* * 0 1
ou A 1
Topo-GREA
15
Mr Achakir
Chapitre 3
ak x k
P( x ) =
k=0
a0
y0
a1
y1
,Y= y2 ,
a
On pose y(k) = P( xk ), k = 0, 1, 2, . . . , n,A=
2
. . .
. . .
am
yn
2
3
m
1 x0 x0 x0 . . . x0
1 x1 x 2 x 3 . . . x m
1
1
1
2 x3 . . . x m .
et t G=
1
x
x
2
2
2
2
. . . . . . . . . . . . . . . . . .
1 xn x2n x3n . . . xnm
On cherche les coefficients ak
, tels que :
n
soit minimale.
G G A =t G Y
GG
1 t
GY
polyfit :donne les coefficients du polynme des moindres carrs dans le sens dcroissant.
polyval :calcule la valeur de ce polynme en tout point x.
Am=polyfit(x,y,m)%m degr du polynme des moindres carrs.
16
0
3
Topo-GREA
17
Mr Achakir
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
1
18
Chapitre 4
PROGRAMMATION
4.1 Function
Dans lediteur de scripts :
function [y]=fonction(x)
y = 1 + 2. x + x. 2
; return
appele depuis la fentre dexcution par son nom :fonction
fonction(5)
ans = 36
>> x = 2 : 0.1 : 2 ;
>> y = f onction( x ) ;
>> plot( x, y)
CHAPITRE 4. PROGRAMMATION
20
CHAPITRE 4. PROGRAMMATION
Fonctions et asymptotes
1. Asymptotes verticale et horizontale % f ( x ) = (3x2 + 6x 1)/( x2 + x 3)
syms x
num = 3 x 2 + 6 x 1 ;
denom = x 2 + x 3 ;
f=num/denom ;
roots=solve(denom) ;
roots
roots =
131/2 /2 1/2
131/2 /2 1/2
% Asymptotes verticales : x=-(1+sqrt(13))/2,x=(-1+sqrt(13))/2
limit(f,inf)
ans =3
% y=3, asymptote horizontale
% On peut reprsenter les asymptotes par les commandes :
%ezplot(fun,[xmin,xmax]) plots fun(x) over the domain : xmin < x < xmax.
ezplot(f)% reprsentation de Cf
hold on % garde Cf dans la figure
% Plot horizontal asymptote y=3
plot([-6 6],[3 3],y)% y couleur yellow, g couleur green
%plot vertical asymptotes x = x1 , x = x2
plot(double(roots(1))*[1 1],[-5 10],r)% couleur red
plot(double(roots(2))*[1 1],[-5 10],r)
title(f(x)=(3x2 + 6x 1)/( x2 + x 3),Asymptotes verticale et horizontale)
hold off
f(x)=(3x2+6x1)/(x2+x3),Asymptotes verticale et horizontale
4
6
0
x
Reprsentation graphique
2. Asymptotes obliques % f(x)=x+2+e(-x)/(x-2)
Topo-GREA
21
Mr Achakir
CHAPITRE 4. PROGRAMMATION
0
x
10
Reprsentation graphique
Suites et formes itratives et test darrt
1. Boucle for ...
clear all
syms x
x0=0.5 ;
F=@(x)(log(1+x)+0.2) ;
u(1)=x0 ;
for k=1 :10
u(k+1)=F(u(k)) ;
end
2. Condition if ...
if condition
instruction ;
else
instruction ;
end
3. Tant que while ...
x=F(x) et x0 donn, xn+1 = F( xn ) n=0,1,2,3....
Applications du cours danalyse numrique
22
CHAPITRE 4. PROGRAMMATION
function[u]=phi(x0,F,testarret )
u(1)=x0 ;
k=1 ;
u(k+1)=F(u(k)) ;
while(abs(u(k+1)-u(k))>testarret )
k=k+1 ;
u(k+1)=F(u(k)) ;
end
end
phi est appele depuis la fentre dexcution par :
clear all
syms x
testa rret = 10( 4) ;
x0=0.5 ;
F=@(x)(log(1+x)+0.2) ;
xx=0 :0.1 :2 ;
yy=F(xx) ;
plot(xx,xx,xx,yy)
FIN
Topo-GREA
23
Mr Achakir