TP MATLAB
Historique Des Commandes ans*3
%-- 19/04/24 09:00 --% 1/3
hhj ans*3
clc a=round(1/3)
%-- 19/04/24 09:06 --% a=round(2/3)
x=5; a=round(1/3,4)
y=2; a=round(1/3,3)
x=y; a=round(1/3,3)*3
ans= a=round(1/3;3)*3
x=y a=vpa(1/3,3)*3
ans= ans=
a=5.8; b=9, a=vpa(1/3,4)*3
22/7; a=vpa(1/3)*3
ans= vpa(pi)
pi=22/7; vpa(pi,4)
pi a=vpa(1/6,4)*6
ens; a=vpa(1/6)*6
pi; a=vpa(around(1/6))*6
pi=; a=around(vpa(1/6))*6
pi; i
ans= i*i
pi ??5
4*22*8**3*1590/21 ??2
ens=4*22*8**3*1590/21 ??1
ens=4*22*8**3*1590/21; ??0
4*22*8**3*1590/21 ?4
4*22*8**3*1590/21; sqrt(5)
ans= sqrt(-1)
4*22*8**3*1590/21 ans= sqrt(-5)
ans= `8+7i
4*22*8**3*1590/21 |8+7i|
4*22*8*3*1590/21 arg(8 + 4i)
a=(1/3)*3 |8 + 7i|
a=1/3 L=33*33
a*3 l=22,5*22,5
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 1 sur 6
TP MATLAB
l=22.5*22.5 v=[1 ln(1) 4 log(2)]
sqrt(L+l) v=[1 log(1) 4 log(2)]
ans/1.54 v=[1 log(1) 4 Log(2)]
ans*1.54 line(2,5,50)
ans/2.54 linspace(1,5,10)
clc v=1:0.4444:5
b=8 line(5,7)
c=7 v+1
x=(b/2)*(sqrt(c*c)-((b/2.5)*(b/2.5)) v[1]+5
x=(b/2)*(sqrt(c*c)-((b/2.5)*(b/2.5))) v(1)+5
delta v(5 8 9, 7 4 5)
d v=(5 8 9, 7 4 5)
x v=(5 8 9; 7 4 5)
x*x+12*x+9 v=][5 8 9; 7 4 5]
x*x+2*x+9 v=[5 8 9; 7 4 5]
X*X+2*X-9 v(5)=v(5)+2
f(x,y)=1/sqrt(|x^3|+|y^3|) v=[v;[5 4 9]]
f(5,9) v(1,3)
f(=1/sqrt(|x^3|+|y^3|) det(v)
x=5; y=8; diag(v)
f=(1/sqrt(|x^3|+|y^3|) v
x=5 v=(v,5,4,8)
y8 v=[v,5,4,8]
y=8 v=[v,[5;4;8]
f v=[v,[5;4;8]]
x=5; y=5; v=[v;[5;4;8]]
f tril(v)
f=(1/sqrt(|x^3|+|y^3|); v
f=(1/sqrt(|x^3|+|y^3|)); tril(v)
x=5; y=5; v=[v;[5;8;4]]
f v=[v;5;8;4]
f=(1/sqrt(abs(x^3)+abs(y^3))); v=[v,[5;8;4]]
x=5; y=5; v=(v;(5 8 9 6))
f v=[v;[5 8 9 6]]
D=4:0.2:6 man(v)
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 2 sur 6
TP MATLAB
tril(v) mean(M)
triU(v) mean(M,2)
triu(v) mean(mean(M))
trace(v) diag(M)
size(v) tril(M)
inv(v) triu(M)
norm(v) color(f)
rang(v) color(0)
rank(v) color(1)
mean(v) y=8+6;
mean(v,1à y
mean(v,1) disp(8*9)
mean(v,2) disp(8*9);
%-- 23/04/24 11:03 --% input("saisir la valeur")
mean(v) input("saisir la valeur");
norm(v) x=input("saisir la valeur");
eye(5,5) x=input('saisir la valeur');
M=(4 5 8; 1 2 3; 8 5 6) 5
M=(4 5 8, 1 2 3, 8 5 6) x
M=(4 5 8,1 2 3,8 5 6) x=input('saisir la valeur'); %Apprends
M=[4 5 8,1 2 3,8 5 6] encore
M=[4 5 8;1 2 3;8 5 6] 9
M=[M,1;2;6] b=disp(I'm here); %Apprends encore
M=[M;1;2;6] b=disp(I'm here)
M=[M;[5 5 8]] b=disp("I'm here")
M=[M,[5;5;8;1]] b=disp('Im here')
rank(M) 8==9
eig(M) M=v
vect(M) p=[1 2 5 8; 8 9 6 5; 4 5 8 7;8 5 9 6]
magic(8,8) p=M
magic(4) p=[1 2 5 8; 8 9 6 5; 4 5 8 7;8 5 9 6]
magic(4, 8) p==M
rand(4) isequal(p,M)
M=rand(4)*8 x=12
mean(M,1) y=45
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 3 sur 6
TP MATLAB
pgcd(x,y) p=[1 2 5 8; 8 9 6 5; 4 5 8 7;8 5 9 6]
pgcd(x;y) p=[1 2 5 8 5 5 8 6 9 1 0]
error("assis") max(p)
error('assis') min(p)
disp('I''m there') cls
function[str]=fonc1(prenom) cleanaxe
function[str]=fonc1[prenom] length(p)
function[str]=fonc1(prenom) stdnbr(p)
str=['hello',prenom] max_min(v)
function[str]=fonc1(prenom) p
prenom='Nawel'; max_min(p)
function[str]=fonc1(prenom) max_min()
function[str]=fonc1(prenom) max_min
str=['hello',prenom]; end min_man
function [str]=fonc1(prenom) min_max
str=['hello ', prenom]; a=2;
end b=20;
function [str]=fonc1(prenom) min_max(a,b)
str=['hello ', prenom]; fact(5)
end fact(-1)
hello('Nawel') fact(5)
ans= fact(-2)
hello('Nawel') ren(9)
hello('Stan') ren(p)
prenom=('Nawel') comparaison
fonc1(prenom) x=5
fonc1('Nawel') comparaison(5)
p=54 donner un nombre
d=8; donner un nombre5
quotient(p,d) donner un nombre 5
qot(9,5) 5
qot(10,5) comparaison
%-- 24/04/24 05:03 --% 8
v szitch
M switch
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 4 sur 6
TP MATLAB
switch(8) Fonctions
switch(0) Comparaison
x=input('donner nombre');
somme(8) if x<0
disp('nombre négatif');
B=[2 -4 5; 1 -5 -9; 8 1 -1] else
disp('nombre positif');
B=
end
2 -4 Factorielle
function [T]=fact(n)
5 T=1;
1 -5 -9 for i=1:n
T=T*i;
8 end
if n==0
1 -1 T=1;
%-- 25/04/24 16:33 --% end
if n<0
hhj error('Entrez un nombre
positif');
%-- 27/04/24 10:32 --%
end
v end
Bonjour
P function [str]=fonc1(prenom)
A=[3 4 5; 7 -2 8; 2 1 0] str=['hello ', prenom];
end
B=[2 -4 5; 1 -5 -9; 8 1 -1] Min_max
function[v]=stdnbr(a,b)
plot(A,B)
v=rand(b,1,a)*100;
plot(A) disp('Liste initiale:');
disp(v);
f=[2 -4 5 1 -5 -9 8 1 -1] for i=1:length(v)
v(i)=((v(i)- a)/(b-a));
plot(f) end
x=0:pi/6:2*pi; end
Quotient
y=sin(x); function[c]=qot(a,b)
plot(x,y,'r:*') c=a/b;
end
z = 2:2:10; Somme note
function N=somme(x)
x = 1:5;
if(x<=0)||(x>=20)
z = 2:2:10; error('x non conforme');
else
plot3(x,y,z,'k*') N=0; S=0;
%initialisation de N et S
y = [0 -2 4 11 3]; while S<=x
plot3(x,y,z,'k*') N=N+1;
%N est incrémenté (augmente) de
grid 1
S=S+1/N;
xlabel('x') % S est remplacée par S+1
ylabel('y') end
%end while
zlabel('z') end
%end if
title('3D Plot')
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 5 sur 6
TP MATLAB
KOUOPGUE NGUEHOU Stanislas (23Y1151)
Info 1 ENS Yaoundé
Page 6 sur 6