-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ27_SpringEnergy.m
More file actions
60 lines (52 loc) · 2.34 KB
/
Q27_SpringEnergy.m
File metadata and controls
60 lines (52 loc) · 2.34 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% =========================================================================================
% FILE NAME: Q27_SpringEnergy.m
% AUTHOR: [Amey Thakur](https://github.com/Amey-Thakur)
% COURSE REPO: https://github.com/Amey-Thakur/COMPUTATIONAL-METHODS-AND-MODELING-FOR-ENGINEERING-APPLICATIONS
% RELEASE DATE: September 08, 2023
% LICENSE: Creative Commons Attribution 4.0 International (CC BY 4.0)
%
% DESCRIPTION:
% This script analyzes Hooke''s Law and Elastic Potential Energy for multiple springs.
% It calculates displacement (x) and stored energy (U = 0.5 * k * x^2) from
% empirical force and spring constant data.
%
% PROBLEM STATEMENT (Q27):
% Five springs have forces F = [11, 7, 8, 10, 9] N and spring constants
% k = [1000, 600, 900, 1300, 700] N/m. Find the compression x for each spring
% (x = F/k) and the stored potential energy (U = 0.5kx^2).
%
% Reference: MATLAB for Engineering Applications, William J. Palm, Chapter 2, Q27.
%
% PHYSICS MODELS:
% 1. Force Relationship: F = k * x => x = F / k
% 2. Potential Energy: U = 0.5 * k * x^2
%
% TECHNOLOGY STACK:
% - Programming Language: MATLAB (R2023a+)
% =========================================================================================
% --- Environment Initialization ---
clc;
clear;
% --- Dataset Acquisition ---
% Dataset for five springs
% Force (N)
F = [11, 7, 8, 10, 9];
% Spring constants (N/m) - (Table specifies N/111 but logic suggests N/m unit standard)
k = [1000, 600, 900, 1300, 700];
% --- Computational Analysis ---
% a. Find the compression (x) in each spring
% x = F ./ k (Vectorized division)
compression = F ./ k;
% b. Find the potential energy stored in each spring
% U = 0.5 .* k .* compression.^2 (Vectorized squared operation)
potential_energy = 0.5 .* k .* compression.^2;
% --- Results Visualization ---
fprintf('--- Spring Elasticity & Energy Analysis ---\n');
fprintf('Spring | Constant (N/m) | Compression (m) | Energy (J)\n');
fprintf('-----------------------------------------------------\n');
for i = 1:length(F)
fprintf(' %d | %4d | %8.5f | %8.5f\n', i, k(i), compression(i), potential_energy(i));
end
fprintf('-----------------------------------------------------\n');
% Professional Scholarly Footer
fprintf('\nScientific Insight: The displacement is linearly proportional to load, while stored energy increases quadratically with displacement.\n');