
How to calculate and plot sin functions?
1 view (last 30 days)
Show older comments
Hello I am a Matlab begginer user. I am trying to calculate and plot the function of a damped sine-wave and the dynamic range (envelope). However, I can not find the right set of code to make the problem run.
This is the equation I am working on:
f(t)=80.^((-1/80)*(t))*sin(0.25*(t)+(pi/3))
I have defined t as t = 100 % seconds
Any help will be welcome.
Thank you
0 Comments
Answers (1)
Stephen23
on 7 Apr 2015
Edited: Stephen23
on 7 Apr 2015
MATLAB works (primarily) with numeric arrays, thus the name "MATrix LABoratory". You need to first create a vector of (numeric) time values, and then perform your operations on it like this:
>> t = 0:0.1:100;
>> s = 80.^(-t/80) .* sin(0.25*t+pi/3);
>> plot(t,s)

These tutorials are highly recommended for all beginners, and introduce many useful aspects of both understanding and using MATLAB:
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!