How can I plot?

7 views (last 30 days)
hem
hem on 19 Nov 2023
Edited: hem on 20 Nov 2023
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.

Accepted Answer

Torsten
Torsten on 19 Nov 2023
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

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!