Professional Documents
Culture Documents
% Giai Phuong Trinh A X 2+b X+C 0: If End If Elseif
% Giai Phuong Trinh A X 2+b X+C 0: If End If Elseif
Câu 3:
a. S=1+3+5…
disp ('tinh tong cac so le')
n=input('nhap gia tri cua n=')
if(n>0)
s=0
for i=1:2:n
s=s+i
end
else
if (n<=0)
disp ('nhap lai gia tri n duong')
end
end
Câu 5:
%a
a=input('nhap a')
x=[-2*pi:0.1:2*pi];
y1=a*sin(x);
plot(x,y1);
%b
b=input('nhap b')
x=[-2*pi:0.1:2*pi];
y2=b*cos(x);
plot(x,y2);
%c
a=input('nhap a')
b=input('nhap b')
x=[-2*pi:0.1:2*pi];
y3=a*sin(x)+b*cos(x);
plot(x,y3);
%d
a=input('nhap a')
b=input('nhap b')
plot(x,y1,x,y2);
%e
a=input('nhap a')
b=input('nhap b')
plot(x,y1,x,y2,x,y3);