Effacer les filtres
Effacer les filtres

change between two values with time dependent

2 vues (au cours des 30 derniers jours)
tcagdas
tcagdas le 25 Mai 2021
Réponse apportée : Ayush le 8 Juil 2024
Hi, I need a signal like sawtooth.
my primary equation is value_max=value_min+((value_max-value_min)/T)*t
t is the clock
T is signal changing time
signal starts with minumum value, then increases until reach maximum value at T.
After that immediately decrease minumum value then start again.
loop cont. with T 2T 3T...

Réponses (1)

Ayush
Ayush le 8 Juil 2024
Hi,
To plot the sawtooth-like signal as per the parameters you have defined, you need to create a time vector to simulate the whole signal. The maximum and minimum values defined will decide the amplitude of the signal. The main calculation will be done using the equation you have provided. For better understanding refer to the example code below:
% Parameters
value_min = 0; % Minimum value of the signal
value_max = 1; % Maximum value of the signal
T = 10; % Signal changing time
t_total = 50; % Total time for the signal
% Time vector
t = 0:0.01:t_total; % Time from 0 to t_total with a step of 0.01
% Sawtooth signal calculation
signal = value_min + ((value_max - value_min) / T) * mod(t, T);
% Plotting the signal
figure;
plot(t, signal);
title('Sawtooth Signal');
xlabel('Time (s)');
ylabel('Signal Value');
grid on;

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by