How do I graph y = sqrt(x) * exp(sin(pi/x))
4 views (last 30 days)
Show older comments
I am very new to Matlab and I need to graph this but I keep getting a division error becasue the domain is 0 to 1 and it has to divide by zero.
0 Comments
Answers (1)
Image Analyst
on 18 Sep 2018
Try this:
x = linspace(eps, 1, 1000);
y = sqrt(x) .* exp(sin(pi./x))
plot(x, y, 'b-', 'lineWidth', 2);
grid on;
title('y = sqrt(x) .* exp(sin(pi./x))', 'FontSize', 20);
xlabel('x', 'FontSize', 20);
ylabel('y', 'FontSize', 20);
2 Comments
Walter Roberson
on 18 Sep 2018
.* is a different operation than * is. .* is formally named times and * is formally named mtimes . .* is element-by-element multiplication between two arrays of equal size. * is algebraic matrix multiplication between two 2D matrices A*B such that size(A,2) == size(B,1) .
./ is element by element division. / is matrix division, with A/B being approximately A * pinv(B)
See Also
Categories
Find more on Directed Graphs 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!