Clear Filters
Clear Filters

how to create a vco with sine wave variation?

5 views (last 30 days)
I was able to create a moving phase animation of a vco using spectrogram. Sort of like a strip chart? But I would like to create a sine wave variation instead of a sawtooth. Code snippet below. Figure 1 is a static display of a sawtooth variation. Figure 2 is a moving phase display based on Figure 1. Figure 3 is my workspace for a sine wave variation.
figure(1)
fs = 10e3;
t = 0:1/fs:2;
x = vco(sawtooth(7*pi*t,0.5),[0.1 0.4]*fs,fs);
spectrogram(x,kaiser(256,5),220,512,fs,'yaxis')
figure(2)
fs = 10e3;
for phase = 0:1:10;
t = 0:1/fs:2;
y = vco(sawtooth(7*pi*t+phase,0.5),[0.1 0.4]*fs,fs);
spectrogram(y,kaiser(256,5),220,512,fs,'yaxis');
disp(phase);
pause(0.1);
end
figure(3)
fs = 10e3;
for phase = 0:1:10;
for freq = 1:1:10
t = 0:1/fs:2;
z = sin(freq*1000*t+phase);
spectrogram(z,kaiser(256,5),220,512,fs,'yaxis');
disp(phase);
pause(0.1);
end
end

Answers (1)

CAROL GARRITTY
CAROL GARRITTY on 19 Sep 2017
Edited: CAROL GARRITTY on 19 Sep 2017
I think I figured it out. I thought I tried this before, but I must have misspelled something.
figure(3)
fs = 10e3;
for phase = 0:1:10;
t = 0:1/fs:2;
z = vco(sin(5*pi*t+phase),[0.1 0.4]*fs,fs);
spectrogram(z,kaiser(256,5),220,512,fs,'yaxis');
disp(phase);
pause(0.1);
end

Categories

Find more on Just for fun 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!