How to use function toi with GHz frequency?

5 views (last 30 days)
Hi all,
I would like to use the function toi https://es.mathworks.com/help/signal/ref/toi.html to generate a plot showing the third-order distortion products from two GHz frequencies 3.6 and 3.7 GHz, however, it shows wrong the central frequencies:
this is the code:
rng default
x = sin(2*pi*3600000000/32*(1:640))+cos(2*pi*3700000000/32*(1:640));
q = x + 0.01*x.^3 + 1e-2*randn(size(x));
toi(q,32)

Accepted Answer

David Goodmanson
David Goodmanson on 17 Feb 2020
Hi Raul
The problem is that you have 32 Hz as a sampling frequency. I assume here that you meant 32GHz. If you look at the time domain plot in fig 1 below, (time axis is not to scale, just shows the general behavior) you get nothing meaningful. That of course carries over to the toi. Figs 3 and 4 show what happens with a 32 GHz sampling frequency. As shown in fig 3, you need to have an adequate number of time points so that the two waves have enough time to beat against each other several times. That allows toi to find good amplitudes for the two intermodulation frequencies, 2f1-f2 and 2f2-f1. The number of time points was upped to 2000.
x = sin(2*pi*3.6e9/32*(1:640))+cos(2*pi*3.7e9/32*(1:640));
figure(1)
plot(x)
grid on
q = x + 0.01*x.^3 + 1e-5*randn(size(x));
figure(2)
toi(q,32)
x = sin(2*pi*3.6e9/32e9*(1:2000))+cos(2*pi*3.7e9/32e9*(1:2000));
figure(3)
plot(x)
grid on
q = x + 0.01*x.^3 + 1e-5*randn(size(x));
figure(4)
toi(q,32e9)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!