how to plot in matlab

조회 수: 2 (최근 30일)
John Auldrey Laurente
John Auldrey Laurente 2020년 2월 8일
답변: Image Analyst 2020년 2월 8일
Hi, how can I plot 3cos3x + 3sin3x in matlab?
thanks!
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 2월 8일
First write the expression in MATLAB syntax. MATLAB syntax does not have any implicit multiplication, and invocation of functions is always of the form FunctionName(parameter)
Once you have the expression in MATLAB syntax, enclose it in quotation marks, and pass that to fplot()
For example,
fplot('7+x^2')

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2020년 2월 8일
Try this:
x = linspace(-2*pi, 2*pi, 1000);
y = 3 * cos(3 * x) + 3 * sin(3 * x);
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
fontSize = 24;
xlabel('x', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
title('y = 3 * cos(3 * x) + 3 * sin(3 * x)', 'FontSize', fontSize);
0000 Screenshot.png

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by