How do I graph y = sqrt(x) * exp(sin(pi/x))

4 views (last 30 days)
Brendan White
Brendan White on 18 Sep 2018
Commented: Walter Roberson on 18 Sep 2018
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.

Answers (1)

Image Analyst
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
Brendan White
Brendan White on 18 Sep 2018
What do the periods before the * and the / do
Walter Roberson
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)

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!