Change of input to a Sinusoidal input

17 visualizaciones (últimos 30 días)
Daniel Clayton
Daniel Clayton el 29 de Jun. de 2020
Editada: Kavya Vuriti el 14 de Jul. de 2020
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
plot(input,Fam1)
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
plot(input,Fam2)
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.
Cheers
Dan

Respuesta aceptada

Kavya Vuriti
Kavya Vuriti el 2 de Jul. de 2020
Editada: Kavya Vuriti el 14 de Jul. de 2020
Hi,
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 comentario
Daniel Clayton
Daniel Clayton el 14 de Jul. de 2020
Hi
Thank you for your help with this. That makes sense.
Regards
Dan

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by