Very new to Matlab probably an easy answer for you guys.

1 view (last 30 days)
I am trying to input the formula that is shown in the picture...however I get an error
Error: File: lastPROBLEM.m Line: 3 Column: 78 Expression or statement is incorrect--possibly unbalanced (, {, or [.
I'm not sure what to do. Here is my current code
v = (-2*(exp(-2*t)).*cos(2*3.14*10*t)-((20*3.14*sin(2*3.14)(10)*t)*exp(-2*t))
I know it's not very neat and probably a headache to look but am really confused as to where the brackets are wrong?
  1 Comment
Star Strider
Star Strider on 7 Sep 2015
First, count the parentheses to be sure they match.
Second, be sure there are operators (for example: addition, subtraction, multiplication, division) where necessary, since MATLAB does not assume operators where none are specified.
Third, be aware of the difference between Array vs. Matrix Operations.

Sign in to comment.

Answers (1)

per isakson
per isakson on 7 Sep 2015
Edited: per isakson on 7 Sep 2015
Try this
>> t = 1:4;
>> v = -2*(exp(-2*t)).*cos(2*pi*10*t) - 20*pi*sin(2*pi*10*t).*exp(-2*t)
v =
-0.2707 -0.0366 -0.0050 -0.0007

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!