- 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()
Create pulses with brackets
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
Walter Roberson
2019 年 2 月 27 日
You have four choices:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!