基于RBF神经网络的非线性系统识别(Matlab代码实现)

💥💥💥💞💞💞欢迎来到本博客❤️❤️❤️💥💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现

💥1 概述

在此仿真中,实现了用于非线性系统的零阶近似的RBF-NN。模拟包括蒙特卡罗模拟设置和 RBF NN 代码。对于系统估计,使用具有固定中心和扩散的高斯核。而 RBF-NN 的权重和偏差使用基于梯度下降的自适应学习算法进行优化。

📚2 运行结果

部分代码:

    % Random initialization of the RBF weights/bias
    W1  = randn(1,n1);
    b   = randn();

    for k=1:epochs
        
        for i1=1:len
            % Calculating the kernel matrix
            for i2=1:n1
                % Euclidean Distance / Gaussian Kernel
                ED(i1,i2)=exp((-(norm(x(i1)-c(i2))^2))/beeta^2);
            end
            
            % Output of the RBF
            y(i1)=W1*ED(i1,:)'+b;
            
            % Desired output + noise/disturbance of measurement
            d(i1)= h(1)*x(i1+2) +h(2)*x(i1+1)+h(3)*x(i1)+h(4)*(cos(h(5)*x(i1+2)) +exp(-abs(x(i1+2))))+sqrt(noise_var)*randn();
            
            % Instantaneous error of estimation
            e(i1)=d(i1)-y(i1);
           
            % Gradient Descent-based adaptive learning (Training)
            W1=W1+learning_rate*e(i1)*ED(i1,:);
            b=b+learning_rate*e(i1);
            
        end
        
        MSE_epoch(k) = mse(e);  % Objective Function (to be minimized)
        
    end
    
    MSE_train=MSE_train+MSE_epoch; % accumulating MSE of each epoch
    epoch_W1=epoch_W1 + W1;        % accumulating weights
    epoch_b=epoch_b + b;           % accumulating bias
    
end

MSE_train=MSE_train./runs;  % Final training MSE after #runs of independent simulations
W1=epoch_W1./runs;          % Final Weights after #runs of independent simulations
b=epoch_b./runs;            % Final bias after #runs of independent simulations

semilogy(MSE_train);    % MSE learning curve
xlabel('Iteration epochs');
ylabel('Mean squared error (dB)');
title('Cost Function')

Final_MSE_train=10*log10(MSE_train(end)); % Final MSE value


%% Test Phase
% Reset input and output
y=0;
d=0;
x=0;
x=[-1*ones(1,delays) ones(1,round(len/4)) -ones(1,round(len/4)) ones(1,round(len/4)) -ones(1,round(len/4))];
x=awgn(x,20);

for i1=1:len
    for i2=1:n1
        ED(i1,i2)=exp((-(norm(x(i1)-c(i2))^2))/beeta^2);
    end
    y(i1)=W1*ED(i1,:)'+b;
    d(i1)= h(1)*x(i1+2) +h(2)*x(i1+1)+h(3)*x(i1)+h(4)*(cos(h(5)*x(i1+2)) +exp(-abs(x(i1+2))));
    e(i1)=d(i1)-y(i1);
end
   
MSE_test=10*log10(mse(e));   %%% Objective Function

figure
subplot(2,1,1)
plot(x(1:end-delays),'r')
title('Input');
legend('Input signal')

subplot(2,1,2)
plot(d(1:end-delays),'r')
hold on
plot(y(delays+1:end))
title('Output');
legend('Desired-output','RBF estimated-output')

🎉3 参考文献

[1]Khan, S., Naseem, I., Togneri, R. et al. Circuits Syst Signal Process (2017) 36: 1639. doi:10.1007/s00034-016-0375-7

🌈4 Matlab代码实现

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
RBF神经网络可以用于非线性系统辨识。下面是一个简单的matlab实现步骤: 1. 收集非线性系统的输入输出数据,构建训练集和测试集。 2. 设计RBF神经网络结构。一般包括输入层、隐藏层和输出层。其,输入层节点数为输入变量的维数,输出层节点数为输出变量的维数,隐藏层节点数根据实际情况设置。 3. 初始化RBF神经网络参数。包括隐层节点的均值向量和方差矩阵,输出层的权重矩阵。 4. 训练RBF神经网络。使用训练集对神经网络进行训练,一般采用误差反向传播算法或者最小二乘法。训练的目标是最小化预测误差。 5. 测试RBF神经网络。使用测试集对神经网络进行测试,计算预测输出与实际输出之间的误差,评估神经网络的性能。 下面是一个简单的matlab代码示例: ```matlab % Load data load nonlinear_system_data % Set up RBF neural network input = X_train'; output = Y_train'; spread = 0.1; hidden = 10; net = newrb(input,output,0,spread,hidden); % Test RBF neural network input_test = X_test'; output_test = Y_test'; y_pred = sim(net,input_test); mse = mean((output_test - y_pred).^2); disp(['MSE on test set: ',num2str(mse)]) ``` 其,nonlinear_system_data是一个mat文件,包含训练集和测试集的输入输出数据。X_train、Y_train、X_test、Y_test分别是训练集和测试集的输入和输出。spread是RBF神经网络的传播参数,hidden是隐藏层节点数。newrb函数可以自动设置神经网络参数。sim函数用于对测试集进行预测。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

荔枝科研社

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值