MATLAB: Y = X . COS(X) . SIN(X) fplotMATLABplottingSymbolic Math Toolbox How would I go about plotting the following equation? Y = X .* cos(X) .* sin(X); Best Answer You didn't say over what range to plot x, so I'm going to assume it's from -20 to 20. Adapt as needed:% Choose a range for x and use 500 points.X = linspace(-20, 20, 500);% Create YY = X .* cos(X) .* sin(X);% Plot the function.plot(X, Y, 'b-', 'LineWidth', 2);grid on;xlabel('X', 'FontSize', 15);ylabel('Y', 'FontSize', 15);title('Y = X .* cos(X) .* sin(X)', 'FontSize', 15);axis equal;% Make a black line at the x and y axesline(xlim, [0, 0], 'Color', 'k', 'LineWidth', 2);line([0, 0], ylim, 'Color', 'k', 'LineWidth', 2); Related SolutionsMATLAB: SUBPLOT : UPPER & LOWER PLOT %truefor i = 1: 6 subplot(6,2,i) y = cos(i*x); plot(x,y) title(sprintf('y = cos(%dx)', i));end MATLAB: I need to write a script for a nonlinear system equations. Example:syms x yeqn1 = cos(x) - sin(y) == 1/10eqn2 = sin(x) + 3 * cos(y) == 2solve(eqn1, eqn2) Related QuestionIntegration showing wrong answerFixing Error using plot Invalid first data argument – new to matlab
Best Answer