Create pulses with brackets
Ältere Kommentare anzeigen
Hi,
How can I create a pulse function with brackets in MATLAB. I have tried the following, but it obviously just gives 6 different points and thus not pulses.
tSpan = [0 62.5 125 125+62.5 250 300];
gluu = [2e-3 5 2e-3 5 2e-3 5];
The idea is that from time 0 to 62.5, the parameter should have the value 2e-3. From 62.5 to 125 it should be 5. From 125 to 187.5 it should be 2e-3 and so on.
Antworten (1)
Walter Roberson
am 27 Feb. 2019
0 Stimmen
You have four choices:
- Decide on a sampling frequency and generate an output vector in which each value is repeated the appropriate number of times. repelem() can help.
- Use the data to generate an anonymous function that does conditional tests on the input time to decide what the output should be
- Use the data to generate an anonymous function that uses heaviside() to calculate the output given times
- Use the symbolic toolbox piecewise() to create a symbolic expression or function to calculate the output given times. Note that matlabFunction() to return anonymous functions cannot handle piecewise() constructs but that matlabFunction with the 'file' output can handle piecewise() but cannot handle vectors of times together with piecewise()
Kategorien
Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!