Matlab
ID #:000580654
SYSTEM MODELLING
LABORATORY 2: MESH ANALYSIS NOF PASSIVE CIRCUITS USING CRAMER’S RULE
FOR DR R. P JENNER
SUNDAY, 30 OCTOBER 2011
TASK 1: Evaluation of determinants by the cofactor technique
Matlab code with its statements clear%This function clears the command window and removes items from the workspace freeing up the system memory% clc%Tis function clears the command windows from any error or junk % a=input('Please enter a value for element1');%This prompt the user to enter a value for a% b=input('Please enter a value for element2');%This prompt the user to enter a value for b% c=input('Please enter a value for element3');%This prompt the user to enter a value for c% d=input('Please enter a value for element4');%This prompt the user to enter a value for d% e=input('Please enter a value for element5');%This prompt the user to enter a value for e% f=input('Please enter a value for element6');%This prompt the user to enter a value for f% g=input('Please enter a value for element7');%This prompt the user to enter a value for g% h=input('Please enter a value for element8');%This prompt the user to enter a value for h% i=input('Please enter a value for element9');%This prompt the user to enter a value for i%
matrix_5=[a b c; d e f; g h i]%This forms the entered values as matrix% The Cofactor Technique cofactor=(a*((e*i)-(f*h)))-(b*((d*i)-(f*g)))+(c*((d*h)-(e*g)))%This is how to find the determinant by using the cofactor technic
The Determinant determinant=det(matrix_5)%Using the det command to find the determint%
Explanation of the code writing above and statements for task 1.
The clear function
This function was used to clear the command windows and remove any items from the workspace by freeing the systems memory.
The clc function
I used the clc function to clear the command window from any errors generated during my debugging of my code any time I run it.
The Input function
This function