Format output with constant display values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, how would I format this code so that it has an output display of
(2*pi*X2)/period
Where the displayed output is not simplified and the denominator is always period (60) and the numerator is always displayed as 2*pi*_.
Basically I want the format to be the same but only the X2 value to change, no simplification.
fs = 5400;
T = 1/fs;
n = 0:959; %sample 960
t = n * T;
xn = cos(540*pi*t) + cos(3600*pi*t) + cos(5040*pi*t);
A = sym([(540*pi)/5400, (3600*pi)/5400, (5040*pi)/5400]);
X = gcd(A);
X2 = A ./ X
[n, d] = numden(X);
n = n * 2;
d = d * 2;
num = X2 * n;
den = [d d d];
period = d; %60
pretty((2*pi*X2)/period);
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!