Borrar filtros
Borrar filtros

Write the matlab code for the following problem

1 visualización (últimos 30 días)
Vipul
Vipul el 8 de Oct. de 2022
Comentada: Vipul el 15 de Oct. de 2022
I have the following error in the code.
clc;clear all;close all;
w=1000:10:6000;
%Engine 1
a=0.03;
b=7.5e-6;
T=torque(w,a,b);
P=T*2*pi.*w/60;
figure(1)
plot(w,T,'LineWidth',1.5)
hold on
figure(2)
plot(w,P/1000,'LineWidth',1.5)
hold on
%Engine 2
a=0.02;
b=3.333e-6;
T=torque(w,a,b);
P=T*2*pi.*w/60;
figure(1)
plot(w,T,'LineWidth',1.5)
figure(2)
plot(w,P/1000,'LineWidth',1.5)
%Engine 3
a=0.015;
b=1.875e-6;
T=torque(w,a,b);
P=T*2*pi.*w/60;
figure(1)
plot(w,T,'LineWidth',1.5)
xlabel('{\omega}(rpm)')
ylabel('Torque (Nm)')
title('Torque Vs speed')
legend('Engine 1','Engine 2','Engine 3')
figure(2)
plot(w,P/1000,'LineWidth',1.5)
xlabel('{\omega}(rpm)')
ylabel('Power (kW)')
title('Power Vs speed')
legend('Engine 1','Engine 2','Engine 3')
function T=torque(w,a,b)
T=120+a*(w-1000)-b*(w-1000).^2;
end
  4 comentarios
parthiban
parthiban el 14 de Oct. de 2022
Hi Vipul & Torsten,
i am also facing same error in above program "T=torque(w,a,b);"
Could you share the working code & help me to resolve this issue.
Thank in advance
Parthiban V
Vipul
Vipul el 15 de Oct. de 2022
Run the code in script and not in command prompt as it consist of functions

Iniciar sesión para comentar.

Respuesta aceptada

Ghazwan
Ghazwan el 8 de Oct. de 2022
you just need to delete this line
Unrecognized function or variable 'torque'.
Also, depending on the version you have, you might need to put the function "torque" in a matlab file individially.
see this URL.

Más respuestas (0)

Categorías

Más información sobre Graphics Objects en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by