Probleme rezolvate examen Matlab

Download Report

Transcript Probleme rezolvate examen Matlab

X^2-2x-4=0
Syms x
>> Solve(‘ x^2-2-x-4=0’)
E=1 supra x-1
X=input(‘dati val lui x ‘);
If x~=1
E=x/(x-1)
Else
Disp(‘nu se poate calcula’)
End
E=x^2 supra (x-1)(x+2)
X=input(‘dati val lui x ‘);
If x~=1 && x~=-2
E=(x+x)/((x-1)*(x+2));
End
1
F(x)={2x ,x>0
{x^2 ,x <0
X=input(‘dati val lui x ‘);
if x e diferit >0
f=2*x
end
if x < 0
f= x^2
end
f(x)= {2x-1 , x<0
{3x , x=0
{1/x , x>0
X=input(‘dati val lui x ‘);
If x<0
f=2*x-1
end
if x =0
f-3*x
end
if x>0
f=1/x
end
f(x)= {3x-2 , x<-2
{x^2+1 , x€ (-2, 3)
{x/x-2 , x>3
X=input(‘dati val lui x ‘);
If x< = -2
f = 3*x-2
end
if x > -2 && x < 3
f = x^2+1
end
if x > =3
f = x/(x-2)
end
graficul functiei se face cu ezplot
syms x
ezplot (‘x+2*x^2-7 ‘ , [0,10]
Sa se calculeze suma elementelor dintr-un vector
Clear v
N=input(‘cate elemente are un vector’);
Nr=0
For i=1:1:n
If v(i)>=0
Nr=m+1;
End
End
Nr
Suma elementelor divizibile cu 3
Clear v
N=input(‘cate elemnte un vector’)
S=0;
For i=1:1:n
If rem (v(i) ,3)==0
S=S+v(i);
End
S
Produsul elementelor impare
P=0;
For i=1:1:n
If rem (v(i),2) ~=0
P==P*v(i);
End
End
P
Sa se afiseze cate elemente sunt positive intr-un vector
Clear v
N=input(‘cate elemente sunt pozitive’);
Nr=0
For i=1:1:n
If (v(i)>0
Nr=nr+1
End
End
nr
Produsul divizibil cu 9
P=1;
For i=1:1:n
If rem (v(i), 9)=0
P=P*v(i);
End
End
S=1^3+2^3+3^3+ + n^3
N=input (‘dati n’)
S=0
For i=1:1:n
S=S+i^3
End
S
S3=1*+2*3+….+n(m+1)
S3=S+i*(i+1)
S4=1+1 supra 2 + … +1 supra n
S4=S+1(i1,n
Несмотря на то,что ты со
мной что-то потеряла, Ты
всё же что-то во мне
нашла...