Clear Filters
Clear Filters

I was trying to plot a sine wave in matlab but it keeps on showing this error: undefined function or method 'sin' for input types of argument 'char'

1 view (last 30 days)
x= sin(4*pi*t);

Answers (1)

John Chilleri
John Chilleri on 22 Jan 2017
Edited: John Chilleri on 22 Jan 2017
You have a colon after t = 0.0:0.001:10: <-
t = 0:0.001:10;
x = sin(4*pi*t);
The above code works for me.
Also, make sure you haven't used pi as a variable name. My guess is that you have assigned a string or character to pi.
Hope this helps!


Find more on MATLAB 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!