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 :-
2. Using the MATLAB "integral" command, numerically determine the Fourier Cosine series of the following function....
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 '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<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...
PLZ shows you Matlab Code X(t) 2 2 46 1. compute the Fourier Series coefficients, ck for the signal x(t) 2. plot magnitude of c and the phase of ck in separate plots (use subplot command) plot the Fourier Series coefficients for the square wave signal: ck(12/9) sinc(2"k/3)
(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) 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
question 2.10-4 with matlab code. 2.10-3 Using direct integration, numerically derive and plot the exponential Fourier series coefficients of the following periodic signals: (a) The signal waveform of Figure P2.1-5 b) The signal waveform of Figure P2.1-10(a) (c) The signal waveform of Figure P2.1-10(0) 210-4 Using the FFT method, repeat Problem 2.10-3. igure P2.1-5 e(a) -2 P2.1-10 -2
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...
During lab 4, we have seen numerical implementation of Fourier Series for periodic signals. As first part of this assignment, you need to write a Matlab function that would take an array representing a single period of a signal (x), corresponding time array (t), and return the Fourier Series coefficients (Ck) in exponential form. The function should also be able to take two (2) optional input arguments: number of Fourier coefficients (Nk) and plot option (p). Use the template ‘fourier_series_exp.m’...
1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...