Given a matrix of torque and speed of engine in MATLAB. Write a code to obtain maximum output of engine at certain torque and speed of engine.
Matlab code
clc
clear all
T=[2 3 5;4 5 8]; % POwer matrix
N=[6 7;8 9;9 10]; % speed matrix
a=size(T);
m=a(1)*a(2); % total no of torque in a torque matrix
b=size(N);
n=b(1)*b(2); % total no of speed in a speed matrix
j=1;
while j<=n
i=1;
while i<=m
P(i,j)=T(i)*N(j);
i=i+1;
end
j=j+1;
end
P % all combination for power
Pmax=max(max(P)) %maximum power
OUTPUT
P =
12 16 18 14 18 20
24 32 36 28 36 40
18 24 27 21 27 30
30 40 45 35 45 50
30 40 45 35 45 50
48 64 72 56 72 80
Pmax =
80
Get Answers For Free
Most questions answered within 1 hours.