Matlab Seassion
Matlab Seassion
Control Statements
If-Else Example:
x = 5;
if x > 0
disp('Positive number');
else
disp('Negative number');
end
For Loop Example:
for i = 1:5
disp(['Iteration: ', num2str(i)]);
end
Data Visualization
Line Plot:
x = linspace(0, 10, 100);
y = sin(x);
plot(x, y, 'r', 'LineWidth', 2);
Customizing Plots:
title('Sine Wave'); xlabel('Time'); ylabel('Amplitude'); grid on;
File Handling
Reading a CSV File:
data = readmatrix('data.csv');
disp(data);
Writing to a File:
writematrix(data, 'output.csv');
Mini-Projects
Project 1: Data Analysis – Read a dataset and generate a report
Project 2: Image Processing – Apply a filter and edge detection
Project 3: Simulation – Solve a simple physics/mathematics problem
Next Steps:
Thank you!