How can I plot?

조회 수: 11 (최근 30일)
hem
hem 2023년 11월 19일
편집: hem 2023년 11월 20일
clear, close all
syms b omega r t theta T delta
b = 0.1; omega = 2*pi/5;
r = b*(1+omega*t); theta = omega*t;
C = [r*cos(theta); r*sin(theta)];
C_diff = diff(C, t);
v = norm(C_diff);
T = 2*pi/omega; 2*pi == omega*T;
delta = 2*pi*b;
tHAT = 1/v*C_diff;
figure()
fplot(r*cos(theta), r*sin(theta), [0 10*pi], 'LineWidth', 1.2)
hold on;
hold off;
axis equal, grid on, box on
xlabel('x'), ylabel('y')
-----------------------
this is my practice code. what should I do to plot tHAT? I need your help.

채택된 답변

Torsten
Torsten 2023년 11월 19일
syms b omega r t theta T delta
b = 0.1; omega = 2*pi/5;
r = b*(1+omega*t); theta = omega*t;
C = [r*cos(theta); r*sin(theta)];
C_diff = diff(C, t);
v = norm(C_diff);
T = 2*pi/omega; 2*pi == omega*T;
delta = 2*pi*b;
tHAT = 1/v*C_diff;
figure()
fplot(r*cos(theta), r*sin(theta), [0 10*pi], 'LineWidth', 1.2)
hold on;
%hold off;
axis equal, grid on, box on
xlabel('x'), ylabel('y')
title('< Archimedes spiral >', 'fontsize', 12)
for i = 1:7
v1 = subs(C_diff,t,5*(i-1));
v1 = v1/norm(v1);
p1 = subs(C,t,5*(i-1));
p2 = p1 + v1;
plot([p1(1),p2(1)],[p1(2),p2(2)],'r');
end
hold off

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by