You are on page 1of 3

%1 zadatak

A=[95 46 92 41 14 2 85; 23 2 74 89 20 75 53; 61 82 18 6 20 45 20; 49 44


41 35 60 93 67; 89 62 94 81 27 47 84; 76 79 92 1 20 42 2]
%a
B=A(3,1:4)
C=A(3:6, 6)
B'
D=[B', C]
%b
F=A(1:2,1:4)
F'
E=[D, F']
%c
c=[E(3,1:1), E(3,3:3)]
%d
e=[18 47 92 74];
f=e(e<80)
%2 zadatak
f=[1 5 0 2 9];
g=[0 1 0 2 1];
%a
s_5=polyval(f,5)
s_5=polyval(g,5)
%b
s=-6:0.5:5;
f=s.^4+5*s.^3+2*s+9;
g=s.^3+2*s+1;
plot(s,f,s,g);
hold on
plot(s,f,'g')
plot(s,g,'r')
%c
h=conv(f,g)
%d
dd=polyder(polyder(h))
%e
[k,o]=deconv(dd,g)

%3zadatak
%a
A=[1 1 1; 2 5 -3; -1 -1 2];
b=[0; 7; 9];
x=A\b
%b
A=[2 1 3; 4 -2 3; 1 3 8];
b=[5; 8; 5^1/2];
x=inv(A)*b
%c
syms x y z real
S=solve('2*x+y+3*z=5','4*x-2*y+3*z=8','x+3*y+8*z=5^1/2')
X=S.x, xx=double(X)
Y=S.y, yy=double(Y)
%4
syms x y;
f=2*x^2/[sqrt(x^2+3*y^2)]
pretty(f)
fx=diff(f,x);
fx=simple(fx);
pretty(fx)
fy=diff(f,y);
fy=simple(fy);
pretty(fy)
%5
syms x
f=[x^3+3*x^2]/[(x+1)*(x^3+1)]
pretty(f)
I=int(f,0,3)
pretty(I)
%6
x1=-1:0.1:1;
y1=x1.^2;
x2=0:0.1:1;
y2=x2.*exp(x2);
x3=-1:0.1:0;
y3=sin(pi*x3);
plot(x1,y1,x2,y2,x3,y3)
grid on
legend('y1(x1)','y2(x2)','y3(x3)')

You might also like