How can I plot this sine and cosine polynomial function? the code is giving me error, and not properly plotting the function... I need the x values to be in a range of 0<=x<=20
1 view (last 30 days)
Show older comments
x = linspace(0,20);
y = (sin(x) + cos(x))/(sin(x.^2));
fplot (y);
0 Comments
Answers (2)
Image Analyst
on 23 Nov 2016
Try this:
x = linspace(0, 20, 3000);
y = (sin(x) + cos(x)) ./ (sin(x.^2));
plot(x, y, 'b*-', 'LineWidth', 2);
grid on;
0 Comments
Star Strider
on 23 Nov 2016
Do element-wise division as well as exponentiation:
syms x
y(x) = (sin(x) + cos(x))./(sin(x^2));
figure(1)
fplot(y, [0 20])
0 Comments
See Also
Categories
Find more on Calculus 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!