|
"Prashant Sandhi" wrote in message <ik55dd$oh6$1@fred.mathworks.com>...
> "Punit" wrote in message <ik36uk$6if$1@fred.mathworks.com>...
> > for ii=1:37
> > Phase=(ii-1)*10;
> > sim('Model')
> > %out{ii}= output from ToWorkspace block
> > end
> >
> > Put this in M file, write 'Phase' in the field -Phase of sine wave generator in simulink model. This code is for 1 freq. write another for loop for all the frequencies.
> > -Punit
>
>
> Thank you Punit for your precious reply.
> I have implemented different frequencies in the code but I am not sure if it is giving all the phases 0°-360° for each frequency
>
>
> 1Hz-0°,1Hz-10°,1Hz-20°.........1Hz-360°
> 1.1Hz-0°, 1.1Hz-10°, 1.1Hz-20°.........1.1Hz-360°
> 1.2Hz-0°, 1.2Hz-10°, 1.2Hz-20°.........1.1Hz-360°
> '
> '
> 5KHz-0°, 5KHz-10°, 5KHz-20°.........5KHz-360°
> '
> '
> 10KHz-0°, 10KHz-10°, 10KHz-20°.........10KHz-360°
> My simulation does not stop, How can I make the code to exit when 10KHz-360° is acheived?
>
>
> This is what I did to the code:
> for ii=1:37
> for f=1:0.1:10e3
> Phase=(ii-1)*10;
> sim('Complete_V7.mdl')
> %out{ii}= output from ToWorkspace block
> end
> end
Dear Punit
This code is perfectly working in FreqnPhase.m file:
for f=1:10:20
for ii=1:2
Phase=(ii-1)*10;
sim('Complete_V7.mdl')
%out{ii}= output from ToWorkspace block
end
end
Explanation: f=1:10:20 means 3 frequencies (1Hz, 11Hz, 21Hz)
ii=1:2,Phase=(ii-1)*10; means two phases only 0° and 10°
This means I am getting 2*3 outputs=6 outputs.
More over I also get the outputs like this:
1st output: with 1Hz 0° Phase shift
2nd output: with 1Hz 10° Phase shift
3rd output: with 11Hz 0° Phase shift
4th output: with 11Hz 10° Phase shift
5th output: with 21Hz 0° Phase shift
6th output: with 21Hz 10° Phase shift
It works perfectly the way I was looking for.
I have another question.
In simulink model I have output Min value and Max Value for each above output.
How can I plot Frequency Vs Min value and Max Value
Example plot: 1Hz, min=2, Max = 8 then continue plotting for all frequencies...
Once again Thank you very much for your previous advise. It was very useful.
Prashant
|