School of Electrical Engineering and Computing Department of Electronics and Communication
School of Electrical Engineering and Computing Department of Electronics and Communication
School of Electrical Engineering and Computing Department of Electronics and Communication
Chapter -3
Solving Equations, Curve Fitting,
and Numerical Techniques
• Linear Algebra
• Polynomials
• Optimization
• Differentiation/Integration
• Differential Equations
System 1 System 2
ANS
A=[1 4;-3 1]; ANS
b=[34;2]; A=[2 -2;-1 1;3 4];
x=A\b; b=[4;3;2];
y=inv(A)*b; x=A\b;
rank(A)
ANS: 7
p2=polyfit(X,Y,2); 4
hold on; 2
1
x = -3:.01:3;
0
plot(x,polyval(p2,x), 'r--');
-1
04/03/2023 Chapter Three -3 -2 -1 0 1 26 3
Numerical Differentiation
0.6
Exercise 0.4
x=0:0.01:2*pi; 0.2
y=sin(x); 0
-0.2
dydx=diff(y)./diff(x); -0.4
plot(y) -0.6
hold on -0.8
-1
plot(dydx) 0 100 200 300 400 500 600 700
[t,x]=ode45('pendulum',[0 10],
[0.9*pi;0]); 8
Position
plot(t,x(:,1)); 6 Velocity
hold on; 4
plot(t,x(:,2),'r'); 2
legend('Position','Velocity'); 0
-2
-4
-6
-8
0 1 2 3 4 5 6 7 8 9 10