Question

2. Using the MATLAB integral command, numerically determine the Fourier Cosine series of the following function. Assume eac
0 0
Add a comment Improve this question Transcribed image text
Answer #1

clc; clear; close; Defining f(x) f = @(x) 2*x.^(1.1) .* cos(3qrt(x+4)); L = 3; L = 3 Coefficient a a0 = (2/L) * integral (1,0

text :-

clc; clear; close;

% Defining f(x)
f = @(x) 2*x.^(1.1) .* cos(sqrt(x+4));
L = 3;          % L = 3

% Coefficient a0
a0 = (2/L) * integral(f,0,L);

% Using 15 terms, calculating a1,a2,a3...an and storing them in vector a
for n = 1 : 15
    integrand = @(x) f(x).*cos(n*pi*x/L);       % integrand for an for current n
    a(n) = (2/L) * integral(integrand,0,L);     % adding coefficient an in a vector
end

% Defining fourier series as a function of x
n = 1:15;           % vector of n values 1 to 15
fourier = @(x) a0./2 + sum(a.*cos(n.*x));       % fourier series

% Ploting
x = linspace(0,3);          % x vector from 0 to 3 (100 elements)
% Evaluating f(x) using fourier expansion for every x in vector x
fourier_vals = arrayfun(fourier,x);     % vector of fourier series evaluated at every x
% Ploting f(x) as red line and fourier evaluations as blue circles
plot(x,f(x),'-r',x,fourier_vals,'ob')
% Labeling the plot and setting legend
xlabel('x');
legend('f(x)','fourier cosine of f(x)','location','best')

Result :-

DO ORDINADO o -f(x) fourier cosine of f(x) .000000 Spoooo O 0.5 1 1.5 NE 2 2.5

Add a comment
Know the answer?
Add Answer to:
2. Using the MATLAB "integral" command, numerically determine the Fourier Cosine series of the following function....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use a MATLAB built-in solver to numerically solve: dy/dx = -yx^2 + 1.5y for 0 lessthanorequalto...

    Use a MATLAB built-in solver to numerically solve: dy/dx = -yx^2 + 1.5y for 0 lessthanorequalto x lessthanorequalto 3 with y(0) = 2 Make a plot of the numerical solution as a solid red line and the exact solution as green circles as shown. The exact solution is y = 2e^-(2x63 - 9x)/6 Use a MATLAB built-in function to numerically calculate the area of the solution. Use the text command to plot the area with 2-digits of precision as shown.

  • (a) The MATLAB command trapz(x,y) computes the integral of the function y with respect to the...

    (a) The MATLAB command trapz(x,y) computes the integral of the function y with respect to the 'variable of integration' r, i.e J ydr. Use MATLAB help to understand how trapz works. (b) Consider r(t) 1 for -1 t1, and r(t) 0 otherwise. Use the trapz command to compute and plot the Fourier transform of r (t). Denote this by X (jw). compute and plot the inverse Fourier transform of 2πX(jw). in part b)? Why, or why not? This is called...

  • Using MATLAB (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs...

    Using MATLAB (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) Using MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series in the interval -3< r<3, In order to do this, the r-interval should be divided into 6001 cqually spaced points by making use of the MATLAB command linspace. (a) Find the Fourier series for 25 { O if 1...

  • (2) Consider the function f(x)- 1 (a) Find the Fourier sine series of f (b) Find...

    (2) Consider the function f(x)- 1 (a) Find the Fourier sine series of f (b) Find the Fourier cosine series of f. (c) Find the odd extension fodd of f. (d) Find the even extension feven of f. (e) Find the Fourier series of fod and compare it with your result -x on 0<a < 1. in (a) (f) Find the Fourier series of feven and compare it with your result in (b)

  • (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) U...

    (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) Using MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series in the interval -3< r<3, In order to do this, the r-interval should be divided into 6001 cqually spaced points by making use of the MATLAB command linspace. (a) Find the Fourier series for 25 { O if 1 r

  • (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) U...

    (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) Using MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series in the interval -3< r<3, In order to do this, the r-interval should be divided into 6001 cqually spaced points by making use of the MATLAB command linspace. (a) Find the Fourier series for 25 { O if 1 r

  • For the function y 1-x for 0 s x s 1 Graph the function's 3 periods 1) Find its formulas for the Fourier series and Fourier coefficients 2) Write out the first three non-zero terms of the Four...

    For the function y 1-x for 0 s x s 1 Graph the function's 3 periods 1) Find its formulas for the Fourier series and Fourier coefficients 2) Write out the first three non-zero terms of the Fourier Series 3) 4) Graph the even extension of the function 5) Find the Fourier series and Fourier coefficients for the even extension 6) Write out the first three non-zero terms of the even Fourier series 7) Graph the odd extension of the...

  • Problem 1 (ME363/ME367) Analytically compute and numerically approximate the free response the fo...

    On MATLAB Problem 1 (ME363/ME367) Analytically compute and numerically approximate the free response the following first-order, resistor- capacitor circuit, where capacitance, C-50pF (pico-Farads) and resistance, R-200ΜΩ (mega-Ohms), for an starting voltage of 2V. The voltage, v(t), represents the potential difference across the both resistor and capacitor, which are wired in parallel 1 Cv(t)v(t)-i(t) Required steps Define a time vector called t, from 0 to 0.1s with 1000 total points. Determine the time constant,T, for this system. By hand, solve for...

  • 4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that...

    4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that the function can be extended and modelled as a Fourier cosine-series: (a) Sketch this extended function in the interval that satisfies: x <4 (b) State the minimum period of this extended function. (C) The general Fourier series is defined as follows: [1 marks] [1 marks] F(x) = 4 + ] Ancos ("E") + ] B, sin("E") [1 marks] State the value of L. (d)...

  • 1. Using the Fourier series analysis Equation 3 for the periodic function r(t) shown in Figure 2....

    1. Using the Fourier series analysis Equation 3 for the periodic function r(t) shown in Figure 2.1, determine both the DC coefficient ao and a general expression for the other Fourier series coefficients ak. Do this by hand, not in Matlab. Show all your work in your lab report. You can add these pages as hand-written pages, rather than typing them in to your lab report, if you prefer Hint 1: It will be easiest to integrate this function from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT