%Assignmet Qwestion chapter no 2:
%2.1:Express the following numbers in polar form
%1
% a=1+2j;
% mag=abs(a);
% angle=phase(a);
%2
% a=-2+j1;
% mag=abs(a);
% angle=phase(a);
%3
% a=(1+2j).*(-2+j1);
% mag=abs(a);
% angle=phase(a);
%4
% a=(1+2j).*(-2+2j);
% mag=abs(a);
% angle=phase(a);
%2:Evaluate the following assignment operator
%1
% c=1;d=2;x=4;
% p1=c.*x+2.*d;
% p2=c.*x-conj(d);
% p=p1/p2;
%2:
% x=2;y=4;z=3;
% l=2.*log10(x)+cos(pi)+abs(y.^2-x.^2)+sqrt(5*x*y);
%3:
% x=-3;
% r=x.^4+4.*x.^3+3.*x^2+6.*x+6;
%4:
% p=3;q=4;
% s=(4.*p+5).*(3.*p+4.*q-10);
%5
% t=2;x=0.5;
% u=x.*e.^(-10.*t);
%6
% a=1;b=2;c=3;
% p=a.^(b.^c);
% c=2;d=3;e=4;
% f=c.^d.^e;
%What is the value of k calculated in the given expression
%1
% i=2;j=3;
% k=i.*3/2+j/4-j.^(3/8);
%2
% x=2;y=3.0;z=4.5;
% k=x^2+y/2.0+z*2;
%3
% i=3;
% j=(i+1)*(i^2)-i/2.0;
%4
% A=2.5;
% A=(A+25)*2.5;
% i=A*4;
% k=i^2;
% A=k/20;
%Evaluate the all trigofun for the different value of the thetha;
% theata=30;
% a=sind(theata);
% b=cosd(theata);
% c=tand(theata);
% d=cotd(theata);
% e=secd(theata);
% f=cscd(theata);
%Evaluate the following inverse trigo function for the given value
% k=1/2;
% a=asin(k);
% a=(180/pi)*a;%for getting the angle in degree
% b=acos(k);
% c=atan(k);
% d=acot(k);
% e=asec(k);
% f=acsc(k);
%Write the assignemt operator to evaluate the following equations
%1
% r=2;h=3;
% volume=pi^2*r*h;
%2:
% N=1000;
% t=10;
% %The data is given in binary;
% T=1*2+0;
% Power=(2*pi*N*T)/60;
%3:
% V=250;I=5;R=2;cos=0.8;W=20;
% Efficiency=(v*I*cos)/((V*I*cos)+(I^2*R+W));
%Determine the value of the each of the logical Expression;
%1:
% x=5;y=15;z=-2;
% k=x>y & x<z;
% a=x<y & x>z;
% b = x==y || y>x;
%for the given electrical circuit with an Inductance L=0.01mH calcuate
%damped natural frequency
% L=0.10/1000;
% R=100;
% c=0.1;
% f1=1/(L*c);
% f2=R^2/(4*(c^2));
% f=sqrt(f1-f2);
%Assignment chapter number 3
%for the given row and coloumn vector solve the following
% p=[1 -2 5];
% q=[2 4 8]';
% k=p*q;
% a=q*p;
% b=p'*q';
% c=sum(p);
% d=sum(q);
% e=mean(p);
% f=mean(q);
% g=length(p);
% h=length(q);
% i=max(p);
% j=max(q);
% a1=min(p);
% a2=min(q);
% a3=prod(p);
% a4=prod(q);
% a5=sort(p);
% a6=sort(q);
%Enter the matrix;
%1:
% A=[1 10;-10 1j];
% k=sin(60);
% z=sym('z');
% e=sym('e');
% x=sym('x');
% B=[x e^x;log10(100) (k)];
%For the given statement write the matlab command given below
% A=[2 -4 6 -8;1 3 5 7;2 12 30 56];
% a1=A(:,1);%This is for all the row and 1st coloumn;
% a2=A(1,:);%All the element from the first row but all the coloumn;
% a3=A(2,3);%Element of the second row and 3 coloumn;
%Given (3x4) matrix q Do the following matlab commands;
% q=[2 3 4;3 4 5;4 5 6;5 6 7];
% q(1,:)=[];%Deleting the first row of the matrix;
% q(:,1:2)=[];%Deleting all the first and second coloumn of the matrix
% % q(2,2)=[];
% B=[-1,1,1,5+1i*2;0,-1,0,20+1i*10;0,0,-1,10+1i*3;1,0,0,0;30+1i*30,50+1i*50,60+1i*60,0];
% B(:,end)=[];
% B(end,:)=[];
% k=q(1:2,1:2);
% q(2,2)=8;
%for the given matrix Reshape the matrix as vector;
% p=[3 4 5 1;5 6 7 2;7 8 9 3];
% a1=reshape(p,[],1);
% a2=reshape(p,[4,3]);
% a3=reshape(p,[6,2]);
%Append the given matrix:
% x=[0 1 2];
% y=[0 2 3 4];
% p=[y,x];
%Generate the following 3x3 matrices of common uses with the help of matrix
%1:Unity or identity matrix;
% u=eye(3);%creating an identity matrix;
% n=zeros(3);creating a null matrix;
% k=ones(3,4);creating matrix with all element 1;
%Show the following command using given matrix;
% A=[2 5 6;3 4 10;7 11 8];
% a1=diag(A);
% a2=diag(A,1);%Where k is a constant lies between -1 to 1;
% a3=poly(A);%it gives the characteristic polynomial;
% a4=eig(A);%It gives the root of the characteristic eqn;
% a5=eigs(A,1);%It gives the kth largest magnitude of eigen value;
% a6=roots(poly(A));%It provides the roots of the characteristic polynomial
%create a 4x4 matrix of random members,multiply all the elements by 10 and
%round of using suitable command
% k=rand(4);
% % p=magic(4);
% % k=randi(4);
% k=k*10;
% k1=round(k);
%For the given matrix determine the determinant and inverse if exist;
%1:
% A=[2 4;8 -1];
% a1=det(A);%The determinant of the matrix is not zero so inverse exist;
% b=inv(A);
% A2=A\A;%A2=A*b is also but slower
% A=[3 0 -2;-1 1 2;0 1 -2];
% a1=det(A);%The determinant of the matrix is not zero so inverse exist;
% b=inv(A);
% A2=A\A;%A2=A*b is also but slower
% A=[1 2 3;0 -1 1;1 0 1];
% a1=det(A);%The determinant of the matrix is not zero so inverse exist;
% b=inv(A);
% A2=A\A;%A2=A*b is also but slower
% A=[0 2 0;3 -3 4;0 2 6];
% a1=det(A);%The determinant of the matrix is not zero so inverse exist;
% b=inv(A);
% A2=A\A;%A2=A*b is also but slower
%Determine the rank of the following given matrices
% L=[4 3;7 2;4 0];
% a1=rank(L);
% L=[3 5 0 9;2 3 6 4];
% a1=rank(L);
% L=[2 0 0;0 0 5];
% a1=rank(L);
% L=[1 2 3;4 5 6;7 8 9];
% a1=rank(L);
% L=[1 2 3;2 4 6;7 0 8];
% a1=rank(L);
%Obtain the following product for the given matrices:
%1:
% A=[3 2 1]';
% B=[6 1 0];
% a1=A*B;
% a2=B*A;
% a3=A*A';
% a4=B'*B;
%2:
% A=[-1 2;0 4];
% B=[2 3;-4 5];
% a1=A*B;
% a2=B*A;
% a3=A*A';
% a4=B'*B;
%3:
% A=[-1 2 3;4 5 6];
% B=[2 4;6 8;10 12];
% a1=A*B;
% a2=B*A;
% a3=A*A';
% a4=B'*B;
% Evaluate
% A=[5 -8 10 -2;0 4 3 -4;2 4 6 8];
% B=[3 -3 -6 5;8 0 5 4;0 4 3 2];
% a1=A+B;
% a2=A-B;
% a3=A.^3;
% a4=B.^4;
% a5=A/B;
%for the given equation the matrix A is:
% A=[1 1 -1;-1 3 -1;3 -5 -2];
% const=[2 2 0]';
% a1=det(A);%The determinant is not zero then the inverse exist;
% a2=inv(A);
% soln=A\const;
% [V,D]=eig(A);
% a3=trace(A);
% a4=rank(A);
% a5=A';
%for the given equation the matrix A is
% A=[1 1 1;-1 3 -1;3 -5 -2];
% const=[4 4 0]';
% a1=det(A);%The determinant is not zero then the inverse exist;
% a2=inv(A);
% soln=A\const;
% [V,D]=eig(A);
% a3=trace(A);
% a4=rank(A);
% a5=A';
%Show the different relational operator:
% x=[1 0 -2];
% y=[0 -4 8];
% a1=x>y;
% a2= x==y;
% a3=(x&y);
%Evaluate:
% x=[0 2 4];
% y=x.^4;
% y1=x.^5;