Introduction to Problem Solving Using MATLAB (2)
Introduction to Problem Solving Using MATLAB (2)
2. Overview of MATLAB
7. Control Structures
- Numerical computation
- Data analysis
- Visualization
- Algorithm development
a = 10;
b = 5;
- Logical (true/false)
Operators:
- Arithmetic: +, -, *, /, .^
- Logical: &, |, ~
v = [1 2 3];
A = [1 2; 3 4];
7. Control Structures
If-else:
if x > 0
disp('Positive');
else
disp('Negative');
end
Loops:
y = x^2;
end
x = 0:0.1:10;
y = sin(x);
plot(x, y);
xlabel('x-axis');
ylabel('y-axis');
title('Sine Wave');
- Financial modeling