How can I plot?

10 vues (au cours des 30 derniers jours)
hem
hem le 19 Nov 2023
Modifié(e) : hem le 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.

Réponse acceptée

Torsten
Torsten le 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

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by