-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ11_MatrixPlotting.m
More file actions
64 lines (56 loc) · 2.26 KB
/
Q11_MatrixPlotting.m
File metadata and controls
64 lines (56 loc) · 2.26 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
61
62
63
64
% =========================================================================================
% FILE NAME: Q11_MatrixPlotting.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 demonstrates the visualization of experimental matrix data, plotting
% multiple force-time relationships from a structured dataset.
%
% PROBLEM STATEMENT (Q11):
% Plot columns 2 and 3 of the following matrix A versus column 1. The data in
% column 1 are time (seconds). The data in columns 2 and 3 are force (newtons).
% A = [ 0 -7 6;
% 5 -4 3;
% 10 -1 9;
% 15 1 0;
% 20 2 -1]
%
% Reference: MATLAB for Engineering Applications, William J. Palm, Chapter 5, Q11.
%
% TECHNOLOGY STACK:
% - Programming Language: MATLAB (R2023a+)
% =========================================================================================
% --- Environment Initialization ---
clc;
clear;
close all;
% --- Dataset Acquisition ---
A = [ 0, -7, 6;
5, -4, 3;
10, -1, 9;
15, 1, 0;
20, 2, -1];
% Extract individual components
time = A(:, 1);
force1 = A(:, 2);
force2 = A(:, 3);
% --- Visualization Engine ---
figure('Color', 'w', 'Name', 'Force-Time Data Analysis');
% Plotting both force columns against time
plot(time, force1, '-ok', 'LineWidth', 1.5, 'MarkerFaceColor', 'k'); % Black with circles
hold on;
plot(time, force2, '--sr', 'LineWidth', 1.5, 'MarkerFaceColor', 'r'); % Red dashed with squares
% Aesthetics and Grid Configuration
grid on;
set(gca, 'FontName', 'Arial', 'FontSize', 10);
xlabel('Time (t) [seconds]', 'FontSize', 12);
ylabel('Force (F) [Newtons]', 'FontSize', 12);
title('Experimental Force-Time Series Analysis', 'FontSize', 14, 'FontWeight', 'bold');
% Legend and Scaling
legend('Sensor Group 1 (Column 2)', 'Sensor Group 2 (Column 3)', 'Location', 'best');
ylim([-10, 10]); % Setting limits for symmetrical comparison
% Professional Scholarly Footer
fprintf('Data Insight: The plot reveals distinct linear trends in Sensor Group 1 and nonlinear fluctuations in Sensor Group 2 over the 20-second interval.\n');