Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given my_sine(x,y): function xsin = my_sin ( x , n ) xsin = 0 ; for i = 1 : n % if it odd
Given my_sine(x,y):
function xsin = my_sin(x , n)
xsin = 0;
for i = 1 : n
% if it odd number term
if mod(i , 2) ~= 0
xsin = xsin + ( x ^ ( 2 * i - 1 ) ) / factorial( 2 * i - 1 );
% if it even number term
else
xsin = xsin - ( x ^ ( 2 * i - 1 ) ) / factorial( 2 * i - 1 );
end
end
end
2. Write a MATLAB function that uses my_sine(x,n) to plot the approximation of the sine function from-T to with increments equal to r, where Ar and n (the number of terms used in the series approximation) should be input arguments of the function and should be specified by the user. The framework for this function could look like this: function sine plot (deltax,n) end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started