Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why is there this error in the code? Using MATLAB gn=3 sn=17 I =(gn*60)+(sn*2) A = 250/(I + 100) T = 1/(5*I) a0 =(A/2) number_of_points

Why is there this error in the code?

Using MATLAB

gn=3

sn=17

I =(gn*60)+(sn*2)

A = 250/(I + 100)

T = 1/(5*I)

a0 =(A/2)

number_of_points = 100

step_size = T/number_of_points

t = 0:step_size:T

f = a0

N=100

n=1:N

an = 0

bn = (A)/(n*pi)*(1 - cos(n*pi))

f = f + an*cos( n*pi*t/(T/2) ) + bn*sin( n*pi*t/(T/2) )

figure(1)

plot(t,f)

hold on

square_wave_f=A/2 + A/2*square(2*pi*t/T)

line_style ='r-'

plot(t,square_wave_f,line_style)

hold off

Step by Step Solution

3.41 Rating (138 Votes )

There are 3 Steps involved in it

Step: 1

The error in the code is in the calculation of bn where the formula se... 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_2

Step: 3

blur-text-image_3

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

Digital Systems Design Using Verilog

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

1st edition

1285051076, 978-1285051079

More Books

Students also viewed these Databases questions

Question

=+a) What kind of design or study is this?

Answered: 1 week ago