フィルターのクリア

Unrecognized function or variable

2 ビュー (過去 30 日間)
Aijalon Marsh
Aijalon Marsh 2022 年 3 月 7 日
回答済み: Davide Masiello 2022 年 3 月 7 日
So I have made a funtion and an m-file for calling that function but for some reason when I run the my m-file it says that the y is unrecognized below is my function and m-file please help me with this error:
Function:
function B2FrequencyResponse10(E, W, A)
K = 1;
t = (0:1.0:10)';
if (0 <= E) < 1
y = K*A-K*A*exp(-(e)*W*t)*(E/sqrt(1-E^2))*sin(W*sqrt(1-E^2)+cos(W*sqrt(1-E^2)));
if E == 1
y = K*A-K*A*(1+W*t)*exp(-(W)*t);
if E > 1
y = K*A-K*A*((E+sqrt(E^2-1))/2*sqrt(E^2-1)*exp(-(E)+sqrt(E^2-1)*W*t)+cos*(W*qrt(E^2-1)*t));
end
end
end
plot(t, y)
title('Step Response of Second-Order System')
xlabel('time')
ylabel('Output y(t)')
legend('E = 0')
end
m-file:
clear
E = 0;
W = 2;
A = 1;
hold on
B2FrequencyResponse10(E, W, A);

採用された回答

Torsten
Torsten 2022 年 3 月 7 日
function B2FrequencyResponse10(E, W, A)
K = 1;
t = (0:1.0:10)';
if E >= 0 & E < 1
y = K*A-K*A*exp(-(E)*W*t)*(E/sqrt(1-E^2))*sin(W*sqrt(1-E^2)+cos(W*sqrt(1-E^2)));
elseif E == 1
y = K*A-K*A*(1+W*t).*exp(-(W)*t);
elseif E > 1
y = K*A-K*A*((E+sqrt(E^2-1))/2*sqrt(E^2-1)*exp(-(E)+sqrt(E^2-1)*W*t)+cos*(W*sqrt(E^2-1)*t));
end
plot(t, y)
title('Step Response of Second-Order System')
xlabel('time')
ylabel('Output y(t)')
legend('E = 0')
end

その他の回答 (1 件)

Davide Masiello
Davide Masiello 2022 年 3 月 7 日
clear,clc
E = 0;
W = 2;
A = 1;
t = (0:1.0:10)';
y = B2FrequencyResponse10(t,E,W,A);
plot(t,y)
title('Step Response of Second-Order System')
xlabel('time')
ylabel('Output y(t)')
legend('E = 0')
function y =B2FrequencyResponse10(t,E,W,A)
K = 1;
if E >= 0 && E < 1
y = K*A-K*A*exp(-(E)*W*t)*(E/sqrt(1-E^2))*sin(W*sqrt(1-E^2)+cos(W*sqrt(1-E^2)));
elseif E == 1
y = K*A-K*A*(1+W*t)*exp(-(W)*t);
else
y = K*A-K*A*((E+sqrt(E^2-1))/2*sqrt(E^2-1)*exp(-(E)+sqrt(E^2-1)*W*t)+cos*(W*qrt(E^2-1)*t));
end
end

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by