clear all; close all; clc;
% (a) solving first one
num=[7 9 12]; % this function creates polynomial in the form
7x^2+9x+12
% note it saves values in workspace it will show u as 7 9 12.
den=conv(poly([0 -7]),[1 10 100]);
% There are two functions conv and poly
% poly([a b c]) function creates a polynomial which has roots as a
b and c
% if u execute poly([0 -7]) u will get polynomial as 1 7 0 means it
created
% a polynomial as x^2+7x.
% conv(a,b) means convolution of a and b means it is
multiplication of two
% polynomials a and b.
% if u execute conv([1 2],[1 2]), it will multiply two polynomials
x+2 and
% x+2 and will give u output as x^2+4x+4.
% by executing given ie conv(poly([0 -7]),[1 10 100]), it is
multiplying
% two polynomials in which one poly([0 -7]) is one which has roots
0 ans -7
% ie x^2+7x and the other polynomial as [1 10 100] means
x^2+10x+100
[A,B,C]=residue(num,den)
% this function is used to get the partial fraction of
num/den.
% here A means values numerators in partial fractions like k +
a/(x+p)+b/(x+q).
% then A will give u a and b
%here B means values of roots of denominators like k + a/(x+p)
+b/(x+q)
%then B will give p and q
%here C is k if numerator has order equal or greater then u will
get k
clear all; close all; clc;
% (b) solving second one
% P1=(s+2)(s+5)(s+6)
% this polynomial refers which has roots -2,-5,-6.
% if u wanna write this polynomial then u have to use command
as
A=poly([-2 -5 -6])
% if u wanna solve polynomial by hand and write in form of
% s^3+13s^2+52s+60 then u can directly
B=[1 13 52 60]
%both will give same answer but first one save ur time and work
as u can
%directly input the roots.
%if u wanna find roots of polynomial, then u can exexcute
command
roots(A)
roots(B)
clear all; close all; clc;
% (c) solving third one
% first input the polynomial
A=[5 7 9 -3 2]
% remenber while input u have to arrange in descending order and
if any
% power is missing then u have to write 0 like x^3+2x+2, it has x^2
missing
% then u have to write as A=[1 0 2 2]
% to find roots execute
roots(A)
X VIEW C:\Users\User PC\Desktop\Untitled.m EDITOR PUBLISH Find Files Compare New Open Save Print Run Section Go To EDIT Breakpoints Run Advance Run and Advance Run and Time Find BREAKPOINTS RUN 1 2 3 FILE NAVIGATE clear all; close all; clc; $ (a) solving first one 4 num=[7 9 12]; $this function creates polynomial in the form 7x^2+9x+12 note it saves values in workspace it will show u as 7 9 12. 5 6 7 - den=conv (poly([0 -7]), [1 10 100]); 000 10 There are two functions conv and poly poly([a b c]) function creates a polynomial which has roots as a b and c if u execute poly([0-7]) u will get polynomial as 1 7 O means it created sa polynomial as x^2+7x. 11 12 13 14 15 16 17 18 conv(a,b) means convolution of a and b means it is multiplication of two polynomials a and b. if u execute conv([1 2],[1 2]), it will multiply two polynomials x+2 and $x+2 and will give u output as x^2+4x+4. by executing given ie conv (poly([0-7]), [1 10 100]), it is multiplying two polynomials in which one poly([0-7]) is one which has roots o ans -7 fie x^2+7x and the other polynomial as [1 10 100] means x^2+10x+100 19 20 21 22 - (A,B,C]=residue (num, den) 23 24 this function is used to get the partial fraction of num/den. here A means values numerators in partial fractions like k + a/(x+p) +b/(x+q). $then A will give u a and b 25 26 27 28 29 30 31 there B means values of roots of denominators like k + a) (x+p) +b/(x+q) then B will give p and a there C is kif numerator has order equal or greater then u will get k scrint In 22
MATLAB R2019a HOME PLOTS APPS do E O Search Documentation Sign In Analyze Code O Preferences Run and Time Set Path Favorites Simulink Layout Add-Ons RESOURCES Clear Commands Parallel CODE SIMULINK ENVIRONMENT New Variable La Find Files > Open Variable New New New Open Compare Import Save Script Live Script Data Workspace Clear Workspace FILE VARIABLE C: Program Files ► MATLAB R2019a bin Current Folder Command Window Name m3iregistry A = registry + util 0.2554 - 0.3382i + win32 0.2554 + 0.3382i win64 -0.5280 + 0.0000i crash_analyzer.cfg 0.0171 + 0.0000i deploytool.bat Icdata.xml Icdata.xsd B = lcdata_utf8.xml Amatlab.exe mbuild.bat -5.0000 + 8.6603i -5.0000 - 8.6603i Details -7.0000 + 0.0000i 0.0000 + 0.0000i Workspace Name НА B HC den Value [0.2554 - 0.33821;0.25. [-5.0000 + 8.6603i;-5.. [] [1,17,170,700,0] [7,9,12] [] num fx >> < >
X IEI C:\Users\User PC\Desktop\Untitled2.m* EDITOR PUBLISH VIEW B w Id Files El Compare Go To New Open Save Print Find 1-2-3-4-5-6-7-8 Run Section EDIT Breakpoints Run Advance Run and Advance Run and Time BREAKPOINTS RUN 1 2 3 FILE NAVIGATE clear all; close all; clc; $ (b) solving second one 5 Pl=(3+2) (3+5) (3+6) this polynomial refers which has roots -2,-5,-6. if u wanna write this polynomial then u have to use command as 6 7 A=poly([-2 -5 -6]) 10 if u wanna solve polynomial by hand and wanna write in form of S^3+13s^2+52s+60 then u can write directly 11 12 13 14 B=(1 13 52 60) 15 16 17 18 both will give same answer but first one save ur time and work as u can $directly input the roots. if u wanna find roots of polynomial, then u can execute command 19 20 21 - roots (A) roots (B) scrint In 13
MATLAB R2019a HOME PLOTS APPS do E O Search Documentation Sign In Analyze Code O Preferences Run and Time Set Path Favorites New New Script Live Script Simulink Layout Add-Ons RESOURCES Clear Commands Parallel New Variable La Find Files > Open Variable New Open Compare Import Save Data Workspace Clear Workspace FILE VARIABLE C: Program Files ► MATLAB R2019a bin Command Window CODE SIMULINK ENVIRONMENT Current Folder i 13 52 60 60 + Name m3iregistry registry util win32 win64 crash_analyzer.cfg deploytool.bat Icdata.xml Icdata.xsd lcdata_utf8.xml Amatlab.exe mbuild.bat 1 13 52 60 ans = Details -6.0000 -5.0000 -2.0000 Workspace Name HA Value [1,13,52,60] [-6.0000;-5.0000;-2.00 [1,13,52,60] ans = ans HB -6.0000 -5.0000 -2.0000 <
C:\Users\User PC\Desktop\Untitled2.m X IEI EDITOR PUBLISH VIEW 1-2-3-4-5-6-7-8- w B old Files Run Section Compare Go To New Open Save EDIT Breakpoints Run Advance Run and Time Print Run and Advance Find BREAKPOINTS RUN 1 2 FILE NAVIGATE clear all; close all; clc; (c) solving third one 3 first input the polynomial 5 A=[5 7 9 -3 2] 7 9 10 * remember while input u have to arrange in decsending order and if and power is missing then u have to write 0 like x^3+2x+2, it has x^2 missing then u have to write as A=[1 0 2 2] 11 12 13 to find roots execute 14 - roots (A) scrint In 14
MATLAB R2019a HOME PLOTS APPS do E O Search Documentation Sign In Analyze Code O Preferences Run and Time Set Path Favorites Simulink Layout Add-Ons RESOURCES Clear Commands III Parallel ENVIRONMENT CODE SIMULINK New Variable La Find Files > Open Variable New New New Open Compare Import Save Script Live Script Data Workspace Clear Workspace FILE VARIABLE C: Program Files ► MATLAB R2019a bin Current Folder Command Window Name m3iregistry A = registry util 5 7 9 -3 win32 win64 crash_analyzer.cfg deploytool.bat Icdata.xml -0.8951 + 1.235li Icdata.xsd -0.8951 - 1.235li lcdata_utf8.xml Amatlab.exe 0.1951 + 0.3659i 0.1951 -0.36591 mbuild.bat + 2 ans = Details A fx >> Workspace Name HA Value [5,7,9,-3,2) [-0.8951 + 1.2351;-0.. Hans >