-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDraw_spring.m
More file actions
35 lines (34 loc) · 853 Bytes
/
Draw_spring.m
File metadata and controls
35 lines (34 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
%% DESCRIPTON
%
% This is a script to initialize the spring
%
%% OUTPUT
%
% Spring is drawn in animation
%
%% VERSION
% Author: Neeraj Kulkarni
% Creation date: 08/08/2024
% Matlab version: matlab online
%
%% REVISION
%
% V1.0 | 08-Aug-2024 | Neeraj Kulkarni | Creation
%
%% PROGRAM
%
%% 1.) Definitions
%% 1.) -General
spring_number_windings = 8;
spring_radius= 0.1;
phi_max = 2*pi*spring_number_windings;
phi_s = 0:pi/50:phi_max;
y_offset_s = 0.2;
y_pos_spring = spring_radius*sin(phi_s)+y_offset_s;
z_pos_spring = spring_radius*cos(phi_s);
spring_foot = position_g(1) - dimension_g(1)/2;
spring_head = x_t(1) + dimension_m(1)/2;
%% 3.) Plot
%% 3.) -Draw Spring
x_pos_spring = phi_s/phi_max*(spring_head-spring_foot) + spring_foot;
plot3(axes_ani, x_pos_spring, y_pos_spring, z_pos_spring, 'b','LineWidth',lnwdth);