MATLAB: How to duplicate a sinwave signal with different variable phase for linear analysis in simulik

control designlinear analysissimulinkvariable transport delay

Hello, I have a model with a input source showed in the fig1. The program have the following callback in InitFcn. The sinwave source have a phase of 0 and a frequency of the variable freqRAD1
v=10;
a=1.8;
b=1;
lambda1=5;
lambda2=0.3
Amplitude1=0.05
freqRAD1=2*pi*v/lambda1;
phase1=(a+b)*2*pi/lambda1;
i want to know if there is any way to change the constant block "freqRAD1" in order to get the frequency from the sinewave. The main reason is when I do the linear analysis the delay from "variable transport delay" doesn't change with the sine-stream used to generate the bode diagram (because i don't know how extract the frequency from the input sine wave1 and used that instead of the constant block) I tried use PLL but no luck

Best Answer

Try using integeration block.
Give sin as input to that block. Now, integeration of sin(2*pi*f*t) with respect to 't' will give -cos(2*pi*f*t)/2*pi*f
From the magnitude of the sine signal divide the magnitude of integeration block output signal will give you the required frequency.