# MATLAB代做|FPGA代做-三维柱形效果图源码程序

### 时间：2021-1-3 0:08:43 点击：

核心提示：MATLAB代做|FPGA代做-三维柱形效果图源码程序...
%二维的，以第二种方法抽样
clc;
clear;
close all;
warning off;

mu=[0,0];
sigema=[1,0.3;0.3,1];
T=5000;
prosigema=1;
thetamin=[-3,-3];
thetamax=[3,3];
seed=1;rand('state',seed);randn('state',seed);
state=zeros(2,T);
theta1=unifrnd(thetamin(1),thetamax(1));
theta2=unifrnd(thetamin(2),thetamax(2));
t=1;
state(1,t)=theta1;
state(2,t)=theta2;
%===run==============
while t<T
t=t+1;
new_theta1=normrnd(theta1,prosigema);
pratio=mvnpdf([new_theta1,theta2],mu,sigema)/...
mvnpdf([theta1,theta2],mu,sigema);
alpha=min([1,pratio]);
u=rand;
if u<alpha
theta1=new_theta1;
end

new_theta2=normrnd(theta2,prosigema);
pratio=mvnpdf([theta1,new_theta2],mu,sigema)/...
mvnpdf([theta1,theta2],mu,sigema);
alpha=min([1,pratio]);
u=rand;
if u<alpha
theta2=new_theta2;
end
state(1,t)=theta1;
state(2,t)=theta2;
end

%=====figure=======
figure(1);clf;
subplot(1,2,1);
nbins=12;
thetabins1=linspace(thetamin(1),thetamax(1),nbins);
thetabins2=linspace(thetamin(1),thetamax(2),nbins);
counts=hist3(state','Edges',{thetabins1,thetabins2});
hist3(state','Edges',{thetabins1,thetabins2});
%bar3(counts,[thetabins1,thetabins2]);
xlabel('\theta1');ylabel('\theta2');zlabel('\counts');
az=61;el=30;view(az,el);

%=============目标分布=========
subplot(1,2,2)
nbins=50;
thetabins1=linspace(thetamin(1),thetamax(1),nbins);
thetabins2=linspace(thetamin(2),thetamax(2),nbins);
[theta1grid,theta2grid]=meshgrid(thetabins1,thetabins2);
zgrid=mvnpdf([theta1grid(:),theta2grid(:)],mu,sigema);
zgrid=reshape(zgrid,nbins,nbins);
surf(theta1grid,theta2grid,zgrid);
xlabel('\theta_1');ylabel('\theta_2');zlabel('pdf(\theta_1,theta_2)');
view(az,el);
xlim([thetamin(1),thetamax(1)]);ylim([thetamin(2),thetamax(2)]);
figure(2)
plot(state(1,:));
figure(3)
plot(state(2,:));

QQ ：1224848052

• 百度搜索
• Google搜索
• 查阅资料过程中
• 论坛发现
• 百度贴吧发现
• 朋友介绍
• 大名：
• 内容：
##### 本类固顶
• matlab代做|matlab专业代做|matlab淘宝代做|python人工智能代做|FPGA项目合作|C代做|C++代做(www.hslogic.com) © 2021 版权所有 All Rights Reserved.
• Email:highspeed_logic@163.com 站长QQ: 1224848052

专业代做/代写/承接、MATLAB、SIMULINK、FPGA项目、博士/硕士/本科毕业设计、课题设计、论文，毕业论文，Coursework、Eassy、Assignment