Change of input to a Sinusoidal input

32 views (last 30 days)
Hi all
I have currently written a piece of code that applies a mathematical formula to an input signal and then plots the result.
The original input was just a single cycle of a cosine wave expressed in a set of values in degrees from 0 to 360 and then displayed as a column vector. This allowed me to make sure that the code worked and that I could plot the results from the equation to what was expected. The following is the code that I have started with:
input = [0;15;30;45;60;75;90;105;120;135;150;165;180;195;210;225;240;255;270;285;300;315;330;345;360]; %input signal
u = cosd (input); %magnitude value in RAPP model equation
s = 1; %smoothness factor
Osat1 = 0.5; %output saturation factor 1
Osat2 = 1.5; %output saturation factor 2
Fam1 = u./((1+(u./Osat1).^(2*s)).^(1/(2*s))); %RAPP model equation
title('Plots of Osat=0.5 and Osat=1.5')
hold on
Fam2 = u./((1+(u./Osat2).^(2*s)).^(1/(2*s))); %RAPP model equation
hold off
I now need to look at how this formula works when a more representative input signal is applied of say 1 kHz.
Unfortunately I can't figure out how to input the signal as a 1 kHz cosine wave whilst also being able to plot this against the results of the model equation. Just repeating the string of numbers 1000 times using the repmat command does not work as this just still plots the single cycle from 0 to 360. I would like to see how the values of Osat1 and Osat2 behave over a larger number of cycles.
Any help on this would be much appreciated.

Accepted Answer

Kavya Vuriti
Kavya Vuriti on 2 Jul 2020
Edited: Kavya Vuriti on 14 Jul 2020
From the question, I understand that you want to generate a cosine input of 1KHz with multiple number of cycles. Try using the following code:
% Define time interval depending on number of cycles you want to generate
t = linspace(0, 100);
% Frequency 1KHz
f = 1000;
% Input to your RAPP equation
u = cos(2*pi*f*t);
  1 Comment
Daniel Clayton
Daniel Clayton on 14 Jul 2020
Thank you for your help with this. That makes sense.

Sign in to comment.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!

Translated by