In this assignment, you will recreate a scientific plot using Gnuplot based on provided data and a pre-written script. The generated plot will be validated against a reference image.
Assignment8/
│
├─data.txt # Dataset for generating the thermal management plot.
│
├─li-on_battery_paper.gp # Gnuplot script to process the data.
│
├─validation.gif # Reference output image.
│
└─README.md # A brief summary of Assignment 8 and its content.
Important: Follow the folder structure exactly as described. This will allow for automated verification of your work.
Create a folder named Assignment8
in your working directory.
Download the data.txt file from the provided resource and place it in the Assignment8
folder.
Create a new file named li-on_battery_paper.gp
inside the Assignment8
folder.
Copy the following Gnuplot script into this file:
#!/usr/bin/gnuplot
# If your data is a comma-separated CSV file, enable this line:
# set datafile separator ","
set terminal gif animate delay 12 font "Times,14"
set output "validation.gif"
# Axis labels
set xlabel "Time (s)"
set ylabel "Temperature (K)"
set y2label "Error (%)"
# x-axis range: 0–8000
set xrange [0:8000]
# Left y-axis range: 270–330
set yrange [270:330]
# Right y-axis range: 0–10
set y2range [0:10]
set y2tics
# Grid and visual settings
set grid xtics lt -1 lw 0.2 lc rgb "gray"
set grid xtics mxtics
set grid ytics mytics
set mytics 2
set mxtics 5
set grid lw 1 lt -1 lc rgb "dark-gray", lw 0.05 lt -1 lc rgb "light-gray"
set border lw 1.5
set key reverse below Left spacing 2
# Your data file:
# (4 columns: time, numerical temperature, experimental temperature, error percentage)
DataFile = "data.txt"
# Assuming a total of 44 rows.
# Loop: from 1 to 44
# every ::0::i => plots rows from 1 to i.
# If the first row is a header, use 'every ::1::i' or 'skip 1'.
do for [i=1:44] {
plot \
DataFile using 1:2 every ::0::i title "Numerical" ps 0.1 lt 7 lc rgb "blue" lw 3 w lp, \
DataFile using 1:3 every ::0::i title "Experimental" ps 0.1 lt 7 lc rgb "red" lw 3 w lp, \
DataFile using 1:4 every ::0::i axes x1y2 title "Error (%)" \
ps 0.1 lt 7 lc rgb "green" lw 3 w lp
}
Run the Gnuplot script to generate the validation.gif
file:
gnuplot li-on_battery_paper.gp
Compare the generated validation.gif
with the reference image provided above.
Ensure that the two match visually.
Create a README.md File:
In the Assignment8
folder, create a README.md
file with a brief summary of each script and output file.
# Assignment 8: Data Visualization Using Gnuplot
## Overview
The Assignment8 folder contains:
1. **`data.txt`**: A dataset derived from a scientific paper for generating a thermal management plot for a lithium-ion battery.
2. **`li-on_battery_paper.gp`**: A Gnuplot script used to process `data.txt` and generate a validation plot in GIF format.
3. **`validation.gif`**: A graphical output generated by running the Gnuplot script, to be compared with the reference image.
4. **`README.md`**: This file provides a summary of the contents and instructions for completing the assignment.
## Objectives
- Learn to visualize data using Gnuplot.
- Understand the steps required to process data files and produce meaningful graphical outputs.
- Gain experience in verifying outputs by comparing them to reference visuals.
## Summary of the Task
Students will download the provided dataset (`data.txt`) and copy the given Gnuplot script into a file named `li-on_battery_paper.gp`. By running this script, they will generate a validation plot (`validation.gif`) and ensure it matches the reference image provided.
## Learning Outcomes
- Developed skills in using Gnuplot for data visualization.
- Learned how to work with datasets and scripting to create scientific plots.
- Enhanced understanding of the importance of validation and reproducibility in scientific computing.
Save and exit the README.md
file. (:wq
)
This plot is derived from the data presented in the following paper:
Türkakar, G., & Hoş, İ. (2023). Numerical investigation of lithium-ion battery thermal management using fins embedded in phase change materials. Journal of the Faculty of Engineering and Architecture of Gazi University, 38(2), 1105-1116.
Before running the submitAssignment.sh
file, make sure you are in the "Assignment 8" folder.
Running this script in any other folder or subfolder may result in missing files being uploaded.
When executed in the correct folder, all files in the "Assignment 8" directory will be included in the submission.
submitAssignment.sh