- Incorrect waveform definition: x(t) = 2 defines a constant function, but we need to define our actual waveform here.
- Incorrect Fourier coefficient formulas: ‘a_n’ and ‘b_n’ formulas appear to be symbolic and not directly related to standard Fourier coefficient formulas.
- Frequency mismatch: The frequency is set to 5 and ‘n’ as 1, but to match the 5/3 Hz component, we should ensure ‘n’ is chosen so that n/T_0 = 5/3.
How to find amplitude of given frequency ?
7 views (last 30 days)
Show older comments

Hi all, I have a question like in the picture
I have tried to solve it with code below, but couldn't get correct answer.
Please need help
clc; clear;
syms x(t) A T0 n
x(t) = 2;
a_0 = (1 / T0) * int(t + 1, t, -1, 1);
a_n = (4 * sin(n * (2 * pi * T0))) / (3 * n * (2 * pi * T0));
b_n = -(4 * cos(n * (2 * pi * T0))) / (3 * n * (2 * pi * T0)) + (4 * sin(n * (2 * pi * T0))) / (3 * n * (2 * pi * T0))^2;
T0 = 0.6;
A = 85.6;
frequency = 5;
n = 1;
eval(sqrt(a_n^2 + b_n^2) * A)
0 Comments
Answers (1)
Dev
on 28 Aug 2025 at 5:19
In the code provided in the question, the Fourier coefficients (‘a_n’ and ‘b_n’) are calculated for a waveform, and then the amplitude for the nth harmonic is computed. However, I have listed some issues with the code below which we can fix to compute the right amplitude-
Also, we need to find the correct harmonic number. Since the wave repeats every 2 seconds, T_0 = 2. Now, with this time period, we can calculate the harmonic, ‘n’, using the formula-
n = given_freq (5/3 Hz) / T_0
Using the above values, we can then calculate the required amplitude.
I hope the above explanation helps to solve the question.
0 Comments
See Also
Categories
Find more on Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!