change between two values with time dependent

2 ビュー (過去 30 日間)
tcagdas
tcagdas 2021 年 5 月 25 日
回答済み: Ayush 2024 年 7 月 8 日
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...

回答 (1 件)

Ayush
Ayush 2024 年 7 月 8 日
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;

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by