Azzera filtri
Azzera filtri

change between two values with time dependent

2 visualizzazioni (ultimi 30 giorni)
tcagdas
tcagdas il 25 Mag 2021
Risposto: Ayush il 8 Lug 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...

Risposte (1)

Ayush
Ayush il 8 Lug 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;

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by