2D plot of x*sin(1/x)

12 views (last 30 days)
feeroz babu
feeroz babu on 15 Dec 2020
Commented: Stephen23 on 15 Dec 2020
x = [-1/pi:0.01:1/pi];
y = x*(sin(1/x));
plot(x,y)

Accepted Answer

KSSV
KSSV on 15 Dec 2020
Edited: KSSV on 15 Dec 2020
x = [-1/pi:0.01:1/pi];
y = x.*(sin(1./x)); %<------ element by element operation
plot(x,y)

More Answers (1)

Walter Roberson
Walter Roberson on 15 Dec 2020
y = x.*(sin(1./x));
In MATLAB the * operator is algebraic matrix multiplication (inner product) and the / operator is matrix division (which is similar to matrix multiplication by pinv() of the array)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products


Release

R2014b

Community Treasure Hunt

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

Start Hunting!