日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

阶跃响应指标的matlab计算

發布時間:2024/1/18 循环神经网络 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 阶跃响应指标的matlab计算 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原文地址:階躍響應指標的matlab計算 作者:了凡春秋

最近師兄讓幫忙計算階躍響應的指標,就是改定實驗數據或仿真數據,求響應指標(概念見程序中)。編程代碼和效果如下

%% 求階躍響應的典型指標
function main_GetPerformanceOfStepResponse
clc
clear all
close all

global gTolerance
gTolerance = 0.05; % 調整時間的偏差容許范圍

%% test
wn = 1;
xi = 0.3;
g = tf(wn^2, [1, 2*xi*wn, wn^2]);
t = 0:0.01:15;
y = step(g,t);

%% 計算階躍響應的指標
stepvalue = 1;
[OverShoot, RiseTime, PeakTime, AdjustTime, SteadyStateError] = GetPerformanceOfStepResponse(t, y, stepvalue);

% 繪圖
figure
plot(t,y)
grid on

line([PeakTime, PeakTime], [0, (1 + OverShoot/100)*stepvalue], 'color', 'r')
text(PeakTime, stepvalue*0.05, sprintf('峰值時間%.2f',PeakTime))
text(PeakTime, (1 + OverShoot/100 + 0.05)*stepvalue, sprintf('超調量%.2f%%',OverShoot))

line([RiseTime, RiseTime], [0, stepvalue], 'color', 'r')
text(RiseTime, -stepvalue*0.05, sprintf('上升時間%.2f',RiseTime))

line([AdjustTime, AdjustTime], [0, stepvalue*(1 + gTolerance)], 'color', 'r')
text(AdjustTime, stepvalue*0.05, sprintf('調整時間%.2f',AdjustTime))

line([AdjustTime t(end)], stepvalue*[(1 - gTolerance), (1 - gTolerance)], 'color', 'r', 'linestyle', '--')
text(AdjustTime, stepvalue*(1 - gTolerance-0.05), sprintf('容許范圍%.2f', 1 - gTolerance))
line([AdjustTime t(end)], stepvalue*[(1 + gTolerance), (1 + gTolerance)], 'color', 'r', 'linestyle', '--')
text(AdjustTime, stepvalue*(1 + gTolerance+0.05), sprintf('容許范圍%.2f', 1 + gTolerance))
text(t(end)*0.9, stepvalue*1.05, sprintf('穩態誤差%f', SteadyStateError))

end

%% 求階躍響應的典型指標
function [OverShoot, RiseTime, PeakTime, AdjustTime, SteadyStateError] = GetPerformanceOfStepResponse(t, y, stepvalue)
% 超調量Mp:最大超調量規定為在暫態期間輸出超過對應于輸入的終值的最大偏離量
% 上升時間tr:在暫態過程中,輸出第一次達到對應于輸入的終值的時間(從t=0開始計時)
% 峰值時間tp:對應于最大超調量發生的時間(從t=0開始計時)
% 調整時間ts:輸出與其對應于輸入的終值之間的偏差達到容許范圍(一般取5%或2%)所經歷的暫態過程時間(從t=0開始計時)
% 穩態誤差err:給定輸入與穩態輸出的差值

global gTolerance

% 超調量和峰值時間
[OSValue, OSIndex] = max(y);
OverShoot = (OSValue - stepvalue)/stepvalue*100;
PeakTime = t(OSIndex);

% 上升時間
index = find(y >= stepvalue, 1, 'first');
RiseTime = t(index);

% 調整時間和穩態誤差
index1 = find(y <= stepvalue*(1 - gTolerance), 1, 'last'); % 容許范圍由全局變量指定
index2 = find(y >= stepvalue*(1 + gTolerance), 1, 'last');

if isempty(index2) % 如果沒有超調量,此值為空
??? index = index1;
else
??? index = max(index1, index2);
end


index = max(index1, index2);
AdjustTime = t(index);

SteadyStateError = mean(y(index:end)) - stepvalue; % 這里的穩態誤差計算為調整時間后的數據平均值與給定輸入的差,概念上是最后時刻的值與給定輸入的差

end

?

運行結果為:

改變容許范圍偏差為0.02的結果

總結

以上是生活随笔為你收集整理的阶跃响应指标的matlab计算的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。