Conditions like 0<t<a*b should be split in Matlab to 0<t && t<a*b.
Note that your code will be overwriting the result and that it relies on undefined variables.
If you want specific suggestions, you will have to explain what you want.
Conditions like 0<t<a*b should be split in Matlab to 0<t && t<a*b.
Note that your code will be overwriting the result and that it relies on undefined variables.
If you want specific suggestions, you will have to explain what you want.
Where exactly do you want to define t?
If you want to assign 0 to all other values, you can use the condition in the calculation itself:
A = sin(2*pi*f*t)*double(0<t && t<a*b);
This works for a scalar t.
What do you want to do next? How do you want to use the value of A next?
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!