Professional Documents
Culture Documents
9 May Practice in Labs
9 May Practice in Labs
a= [1 2 3; 4 5 6; 7 8 9;]
a(2,:) % 2 is for row and : is for column
a(:,2:3) % all rows and 2nd to 3rd column
a(:,2)=[] % all rows 2nd column delete krky [] is for deleting the 2nd
column
a= [1 2 3; 4 5 6; 7 8 9;]
b= a([2 3],[1 2])
Ans:
a=
1 2 3
4 5 6
7 8 9
b=
4 5
7 8
a= [1 2 3; 4 5 6; 7 8 9;]
a' % this is for transpose
g=input('enter valu')
enter value
a=2;
b=2;
c=4;
d=b*b-4*a*c;
if d<0
disp('roots are imaginary')
else
disp('roots are real')
end
polynomial solution:
g=poly([-1+2j -1-2j -1 0 0]);
poly2str(g,'s')
f=[2 2 2];
poly2str(f,'s')
g=poly([-1+2j -1-2j -1 0 0]);
poly2str(g,'s')
h=conv(f,g)
a=2;
b=2;
c=4;
d=b*b-4*a*c;
if d<0
disp('pakistan')
elseif d==0
disp('pak')
else
disp('input')
end