Professional Documents
Culture Documents
Hadi Saadat Program Matlab 523-660
Hadi Saadat Program Matlab 523-660
Hadi Saadat Program Matlab 523-660
Hal 613
x = [10; 20; 40; 60; 80];
y = [x. log(x)];
fprintf(\n Number Natural log\n)
fprintf(%4i \t %8.3f\n,y)
hal 619
A =[4 -2 10; 2 10 -12; -4 -6 16]
Hal 624
A =[0 1 -1;-6 -11 6; -6 -11 5]
p = poly(A)
r = roots(p)
Hal 625
A =[1 7 12]; B = [1 0 9];
C = conv(A,B);
Z = [1 9 37 81 52]; Y = [1 4 13];
[X,r] = deconv(Z,Y)
Hal 626
c = [1 2 3 1];
x = 0:1:4;
y = polyval(c, x)
Hal 627
b = [ 2 0 9 1];
a = [1 1 4 4];
[r,p,k] = residue(b,1)
Hal 630
x = [0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0];
y = [10 10 16 24 30 38 52 68 82 96 123];
plot(x, y), grid
xlabel(x), ylabel(y), title (A simple plot example)
Hal 631
x = [0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0];
y = [10 10 16 24 30 38 52 68 82 96 123];
p = polyfit(x, y, 2);
yc = polyval(p, x);
plot(x, y, x, x, yc)
xlabel(x), ylabel(y),grid
title (Polynomial Curve Fitting)
legend(Actual data, Fitted Polynomial)
Hal 632
t=0:.005:3; c = 1+ exp(-2*t).*sin(8*t pi/2);
[cp, k] = max (c) % cp is the maximum value of c at interval k
tp = t(k)
%sinusoidal voltage
%sinusoidal current
%instantaneous power
fR = 3/2*Fm;
subplot(2, 2, 3), plot(-fR*cos(wt), fR*sin(wt))
title(Rotating mmg), subplot(111)