0% found this document useful (0 votes)
19 views3 pages

Mathlab Class 1.23.25

The document contains MATLAB commands for various operations including transfer function calculations, polynomial conversions, and plotting data related to load and unit costs of water for different crops. It demonstrates the use of functions like tf2zp, zp2tf, conv, and feedback to manipulate transfer functions and visualize results. Additionally, it includes plotting commands to display the relationship between extension and load, as well as the economic cost of production for different crops.

Uploaded by

onabamiropeace11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views3 pages

Mathlab Class 1.23.25

The document contains MATLAB commands for various operations including transfer function calculations, polynomial conversions, and plotting data related to load and unit costs of water for different crops. It demonstrates the use of functions like tf2zp, zp2tf, conv, and feedback to manipulate transfer functions and visualize results. Additionally, it includes plotting commands to display the relationship between extension and load, as well as the economic cost of production for different crops.

Uploaded by

onabamiropeace11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MATLAB Command Window Page 1

January 23, 2025 10:19:32 AM

>> num = [1 6 5];


den = [1 16 10 25];
[z,p,k] = tf2zp(num,den)

z =

-5
-1

p =

-15.4577 + 0.0000i
-0.2711 + 1.2425i
-0.2711 - 1.2425i

k =

>>
>>
>>
>> z = [-1;-5];
p = [0;-3;-4;7];
k = 5;
[num,den] = zp2tf(z,p,k);
printsys(num,den,'s')

num/den =

5 s^2 + 30 s + 25
-------------------
s^4 - 37 s^2 - 84 s
>>
>>
>> A1 = [1 2];
A2= [1 4];
num = conv(A1,A2)
num1 = 6*num
B1 = [1 3];
B2 = [1 5];
B3 = [1 0];
den = conv(B1,B2);
den1 = conv(B3,den)
printsys(num1,den1)

pzmap(num1,den1)
MATLAB Command Window Page 2
January 23, 2025 10:19:32 AM

num =

1 6 8

num1 =

6 36 48

den1 =

1 8 15 0

num/den =

6 s^2 + 36 s + 48
------------------
s^3 + 8 s^2 + 15 s
>>
>>
>> g1 = tf([0 0 1],[1 0 0]); % first forward transfer gain
f1 = tf([1 0],[1 1]); % feedback transfer gain
t = feedback(g1,f1,-1)

t =

s + 1
-------------
s^3 + s^2 + s

Continuous-time transfer function.

>>
>>
>> g1 = tf([1],[1 0 0]);% first forward transfer gain
g2 = tf([1 0],[1 0 0]);
g11 = g1*g2
f1 = tf([1],[1 1]); % feedback transfer gain
t = feedback(g11,f1,-1)

g11 =

s
---
s^4
MATLAB Command Window Page 3
January 23, 2025 10:19:32 AM

Continuous-time transfer function.

t =

s^2 + s
-------------
s^5 + s^4 + s

Continuous-time transfer function.

>>
>>
>>
>> % load(kw) = a
% extension(mm) = b
a = [0 4 6 12 16 20 24 28 30];
b = [0 0.017 0.039 0.058 0.078 0.097 0.117 0.133 0.149];
plot(a,b,'-xr'), xlabel('Extension (mm)'), ylabel('load (kn)')
>>
>>
>>
>> % Unit cost of water
% Rice = r
% Maize = m
% Tomato = t
% Pepper = p
% Onion = o
x = [10:10:50];
r = [9.175 18.235 27.349 36.47 45.588];
m = [12.913 25.719 38.578 51.439 64.385];
t = [13.028 22.719 31.578 48.437 62.385];
p = [6.692 13.618 20.386 25.719 38.578];
o = [14.332 28.784 43.267 57.665 72.112];
plot(x,r,'-xr', x,m,'-xb', x,t,'-xg', x,p,'-xy', x,o, '-xb'), xlabel('pumphead (m)'),
ylabel('unit cost of water(s/m^3)')
legend('Rice', 'Maize', 'Tomato', 'Pepper', 'Onion');
title('Economic cost of production');
>>

You might also like