Tools for Mechanical Engineering Graded IC8 In this IC were

! Tools for Mechanical Engineering Graded IC8 In this IC we\'re going to combine several skills that we\'ve previously used into one assignment where we look at the convergence of the series expansion of a function. The series expansion of sine is given by: (-1) 2n+1 (2n + 1)! y sin(x) The question is, how big should N be for a \"good\" solution? In math-speak that would be, how many terms should we take in the expansion? To answer this question, we\'re going to use computational tools (MATLAB) in order to look at different values of N. Basic Plan: 1) Create a function file called: Allen Mathis_sine (except use your own name). This function should accept two inputs, x and N. This means that the first line of your code will look like the following: function output A1len Mathis sine (x, N) Create a m-file which will do the following: a. Clear memory, clear the command line screen, and close all open figures. b. Define a vector called x which has 1000 elements from 0 to 2m. c. Calculate different vectors called y1,y2ys, and y, with: 2) Ni = 1 Na = 3 N, = 5 d. Generate a final vector called yactual which uses MATLAB\'s built in sine function: yactual-sin(x) t in ePortfolie Download y Details k: View this topic

Solution

function [output] = Allen_Mathis_sine(x,N)
sum=0;
for k = 1:1: length(x)
sum(k)=x(k);
for c=1:1:N
sum(k) = sum(k) + (x(k)^((2*c)+1))*((-1)^c)/(factorial((2^c)+1));
end
output(k) = sum(k);
end
end

b = 2*3.1416; %Limite superior solucion
n = 1000; %Numero de puntos de red
h = (b - a)/(n - 1); %Espaciado entre puntos de red

X(1) = x0;
for j = 1:n-1;
X(j+1) = X(j) + h;
end

X

[y1] = Allen_Mathis_sine(X,1);
[y2] = Allen_Mathis_sine(X,3);
[y3] = Allen_Mathis_sine(X,5);
[y4] = Allen_Mathis_sine(X,7);
[yactual] = sin(X);

plot(X,yactual)
hold on
plot(X,y1)
hold on
plot(X,y2)
hold on
plot(X,y3)
hold on
plot(X,y4)

hold off

title(\'SOLUTION TO IC 8\')
xlabel(\'x\')
ylabel(\'sin(x)\')

%I need more time tu end with colors and other stuff. Please ask for
%another question so I can keep going

 ! Tools for Mechanical Engineering Graded IC8 In this IC we\'re going to combine several skills that we\'ve previously used into one assignment where we look a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site