Perform the following calculations in MATLAB using the polyn
Perform the following calculations in MATLAB using the polynomials
p1=x^3+3x^2+3x+1
p2=x^2+3x+1
Find the roots of each Find the derivatives and integrals of each (do not just report the coefficients; show the whole answer)
Add, subtract, and multiply the two polynomials together (do not just report the coefficients; show the whole answer)
Find the derivatives and integrals of each (do not just report the coefficients; show the whole answer)
Divide p2 by p1 (construct the polynomial from the coefficients given)
Solution
use the following post .. please comment for any clarification.
-----------------------------------------------------------------------------
clc;
close all;
clear all;
syms x;
%% function definition %%
p1 = x^3+3*x^2+3*x+1;
p2 = x^2+3*x+1;
%% part 1 operations %%
disp(\'solution of p1\');
solve(p1==0)
disp(\'solution of p2\');
solve(p2==0)
disp(\'differential of p1\');
diff(p1)
disp(\'differential of p2\');
diff(p2)
disp(\'integral of p1\');
int(p1)
disp(\'integral of p2\');
int(p2)
%% part 2 operations %%
disp(\'sum of p1 and p2 \');
p1+p2
disp(\'subtraction of p2\');
p1-p2
disp(\'multilication of p1\');
expand(p1*p2)

