Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (45 points) Write o MATLAB function [a0, an, bn] = NumFourier (t,x,n) that constructs the harmonic analysis of a given function x(t). The function

image text in transcribed
4. (45 points) Write o MATLAB function [a0, an, bn] = NumFourier (t,x,n) that constructs the harmonic analysis of a given function x(t). The function requires the following input data: a) t= array of dimension N1, containing the known values of t;t(i)=ti, in one cycle. b) x= array of dimension N1, coutaining the known values of x(t);x(i)=x(ti). c) n= number of Foturier coefficients to be cotpputed. where N is the mumber of points at which the values of x(t) are known. The default value of n (if the user does not specify) is the value that makes the Fourier series expansion exactly matehes the given input data. The output of the function is a) a0=a0 b) an = array of dimension n1 defining the coefficients an; an (i)=ai for i=1,2,,n. c) bn= array of dimension n1 defining the coefficients bn;bn(i)=bc for i=1,2,,n. The function plots the data points together with Foturier series expansion and display the results using fprintr command. The function should display an errot if t and x doea not have the same size. You could employ Trapeeoidal rule, trapz, to jerform the integration for determining the Fourier coefficients. A demo of the function output when employing the data in Example 1.20 fromi your textbook is shown below. Fourder series expanaion of the function x(t) Data: Number of data points in one cycle =13 Number of Fourier coefficient required =3 Tine period =1.200000e01s Results of Fourier analysis: a0=6.816667e+04valuesof1a(1)b(1)1232.699636e+041.416667e+035.833333e+033.307798e+032.333333e+03 values of 1x(1)xm(1) 123456789101112130.000000e+002.000000e+043.400000e+044.200000e+044.900000e+045.300000e+047.000000e+046.000000e+043.600000e+042.200000e+041.600000e+047.000000e+030.000000e+002.670303e+031.635770e+043.602992e+044.330780e+044.510961e+045.686677e+046.832970e+045.947564e+043.697008e+042.202554e+041.539039e+046.466564e+032.670303e+03

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago