Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MATLAB code that performs the function at(polynomials\' calculator and p

ID: 3210248 • Letter: W

Question

Write a MATLAB code that performs the function at(polynomials' calculator and plotter, so that the user can make the basic mathematical operations( + ,-, * , / ) on any number and any order of polynomials and can obtain the required plots. The code has to perform the following: Make any number of calculations( + , . , * , / ) on polynomials entered by the user, and find the final result. All input polynomials have to be plotted on the same graph on a domain [-2,2]. -Resulted polynomial has to be plotted on a separate graph on a domain [-2, 2] A mia bas to be ploted onsparate axah on a

Explanation / Answer

SOLUTION:

%% Function of exp(x) = sum(x^n/n!):n = 0 to infinity

% n = input('Enter the heightest order of polynomial');
n = 4 ;
x = -2:0.1:2;
pol_cal = zeros(n+1,length(x));   
pol_cal(1,:) = 1; % First constant term of polynomial
for k = 1:n
for ii=1:length(x)
pol_cal(k+1,ii) = x(ii)^k / factorial(k);
end
end
Height_Order_Pol = sum(pol_cal);
%% Plotting each order term plot
figure(1)
hold on; box on;
for ii=1:n+1
plot(x,pol_cal(ii,:));
end
legend('n = 0','n = 1','n = 2', 'n =3','n = 4')
%% Plotting of hightest order polynomial
figure(2)
hold on; box on;
plot(x,Height_Order_Pol);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote