MATLAB: How to draw equations I found on WolframAlpha in MatLAB

drawplot

Wolfram says that this particular drawing is a parametric. I dont know if that matters?
figure;
hold on;
X = insert long eq here
Y = insert long eq here
plot(X, Y, '-k.');
xlim([-inf, inf])
ylim([-inf, inf])
hold off

Best Answer

You must convert the mathematical notation to a syntax recognized by Matlab.
For example, this segment,
becomes any of the following
% 't' is defined in that link as,
t = linspace(0,92*pi,5000); % 5000 is arbitrarily chosen
% Minimalist version
-1/38 * sin(17/11 - 37*t) - 1/30 * sin(31/21 - 35*t)
% Showing use of .* notation (not required here due to matrix dimensions)
-1/38 * sin(17/11 - 37.*t) - 1/30 * sin(31/21 - 35.*t)
% Showing use of parentheses to perceptually group the terms but not
% required due to order of operations
((-1/38) * sin((17/11) - (37.*t))) - ((1/30) * sin((31/21) - (35.*t)))
The key points are
  1. n(sin(x)) must become n*sin(x) or n.*sin(x) depending on the array sizes. You want element-wise operations.
  2. Undersand the order of operations, or use parentheses to group your terms.
  3. Frequently run sections of the equation as you convert each set of terms so you can catch errors early on. The output should be equal in size to the variable t.
  4. For square roots, use sqrt().
  5. As indicated in the WolframAlpha link you shared, theta(x) is the Heaviside step function.
  6. Also indicated in the link, sgn is the sign function.
Update
Due to the negative associations this image may have with current social issues (which I just learned about), I'll refrain from continuing with this thread. I hope the answer helps to learn about converting mathematical notation to Matlab syntax but please be socially minded with the meme.