Vous êtes sur la page 1sur 2

TP N01 

: Boucle For

clear all
close all
clc
for theta=1:0.01:pi
x=cos(pi+theta)
end

clear all
close all
clc
u=[];
v=[];
for theta=0:0.1:pi
x=cos(theta);
u=[u,x]
y=sin(theta);
v=[v,y]
end
plot(u,v)

clear all
close all
clc
theta=[0,pi/4,pi/3,pi/2,pi]
for i=1:length(theta)
x=cos(theta);
end
plot(theta,x)

clear all
close all
clc
for theta=1:pi
x=cos(theta);
disp(x);
end
plot(theta,x)

TP N 02
clear all
close all
clc

a=exp(5);
theta=30;
x=0:0.05:1;
y=a*x.*cosd(2*theta);
plot(x,y)
TP 03 function
function[s]=section(a,b)
s=a*b;

function[s]= surface(d)
s=pi*((d^2)/4);

TP n04 somme et remplaire un vecteur vide


clear all
close all
clc
x=rand(1,1000);
y=rand(1,1000);
s=0;
k=1
v=[]
for i=x
s=s+i*y(k);
v=[v,s]
k=k+1;
disp(s)
end

introduire des données


clc
clear all
close all
a=input('introduire la valeur de a');
b=input('introduire la valeur de b');
s=section(a,b);
disp(s)

Vous aimerez peut-être aussi