I am trying to implement a triangular modulation in Matlab, however I am having issues implementing the resulting frequency ramps.
I have the following input signal (in reality, this signal is the input for a voltage controlled oscillator):
Also, I have generated a matrix "z" which assigns a frequency value to each amplitude value of the input signal:
1st row: VCO output frequency [Hz]
I am looking for tips to implement the code for the output of the VCO, which should be starting at 1 Hz at 0s, 50 Hz at 0.05s and then falling to 1 Hz again.
Code looks like this so far:
fs = 1000; %Sampling frequency [Hz] t = 0:1/fs:1e2/fs; %Signal duration [s] f = 10; %Base frequency [Hz] f_mod = [1:1:50 51:-1:1]; %Frequency vector [Hz] x = 0.5 * sawtooth(2*pi*f*t, 0.5)+0.5; %Input signal generation for VCO z = [f_mod; x]; %matrix assigns ampl of x with freq of VCO y = %output signal of VCO subplot(2, 1, 1) plot(t,x) xlabel('Time in seconds [t]') ylabel('Amplitude') subplot(2, 1, 2) plot(t,y) xlabel('time in seconds [t]') ylabel('Amplitude')