please guide me how to make plot from –pi to pi.

조회 수: 22 (최근 30일)
Saleh
Saleh 2022년 10월 18일
댓글: Saleh 2022년 10월 18일
in this equation
where k = 6+ 6, and the size = 30+ 9.
The plot should be from –pi to pi
X = size*cos(kt)*cos(t).
Y = size*cos(kt)*sin(t).
i use to make it like this but it gives me errors it still asks me about t is undefined
k = 6 + 6;
size = 30 + 9;
X = size * cos (k*t) * cos(t);
Y = size * cos (k*t) * sin(t);

채택된 답변

Torsten
Torsten 2022년 10월 18일
k = 6 + 6;
size = 30 + 9;
t = linspace(-pi,pi,1000);
X = size * cos (k*t) .* cos(t);
Y = size * cos (k*t) .* sin(t);
plot(X,Y)
  댓글 수: 4
Saleh
Saleh 2022년 10월 18일
i should make table and graph as i want semester marks as per the table suing either stem or bar function. The graph should be entitled “Spring Semester Marks”, with x and y axis labelled. Customize your graphs to be as unique as possible
title ('Spring Semester Marks')
xlable('Spring Semester Marks')
ylable('Spring Semester Marks')
patients = table(booksname,1,2,3,4)
is it like this ?

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

추가 답변 (2개)

David Hill
David Hill 2022년 10월 18일
k = 12;
size = 39;
X =@(t) size * cos (k*t) .* cos(t);
Y =@(t) size * cos (k*t) .* sin(t);
t=-pi:.01:pi;
plot(t,X(t),t,Y(t))
  댓글 수: 1
Image Analyst
Image Analyst 2022년 10월 18일
Except that they should not use size as the name of a variable.

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


Image Analyst
Image Analyst 2022년 10월 18일
편집: Image Analyst 2022년 10월 18일
Try this:
t = linspace(-pi, pi, 1000);
period = pi/2;
amplitude = 39;
k = 12;
X = amplitude * cos (2 * pi * t * k / period) .* cos(2 * pi * t / period);
subplot(3, 1, 1);
plot(t, X, 'b-', 'LineWidth', 2);
grid on;
title('X')
Y = amplitude * cos (2 * pi * t * k / period) .* sin(2 * pi * t / period);
subplot(3, 1, 2);
plot(t, Y, 'r-', 'LineWidth', 2);
grid on;
title('Y')
subplot(3, 1, 3);
plot(X, Y, 'm-')
axis equal
title('Y vs. X')

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by