Markov的仿真

Posted fpga&matlab

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Markov的仿真相关的知识,希望对你有一定的参考价值。

% main.m
% 主程序:对于不同的K,N值作折线图。参数FrameNum为帧的最大个数。
% by 姜晶
% 2013.4.10
clear;
FrameNum=7;
X=0:1:FrameNum;

[F(1,:) Y(1,:)]=Markov(17,20,FrameNum);

[F(2,:) Y(2,:)]=Markov(12,20,FrameNum);

[F(3,:) Y(3,:)]=Markov(7,20,FrameNum);

[F(4,:) Y(4,:)]=Markov(15,15,FrameNum);

[F(5,:) Y(5,:)]=Markov(10,15,FrameNum);

[F(6,:) Y(6,:)]=Markov(5,15,FrameNum);
 
%仿真和分析画在一起(平均选到时隙的节点数)
figure(1);
plot(X,Y(1,:),'k-o');
hold on;
plot(X,simulation(17,20,FrameNum),'k:.');
hold on;
plot(X,Y(2,:),'k-o');
hold on;
plot(X,Y(3,:),'k-o');
hold on;
plot(X,Y(4,:),'k-o');
hold on;
plot(X,Y(5,:),'k-o');
hold on;
plot(X,Y(6,:),'k-o');
hold on;

plot(X,simulation(12,20,FrameNum),'k:.');
hold on;
plot(X,simulation(7,20,FrameNum),'k:.');
hold on;
plot(X,simulation(15,15,FrameNum),'k:.');
hold on;
plot(X,simulation(10,15,FrameNum),'k:.');
hold on;
plot(X,simulation(5,15,FrameNum),'k:.');
xlabel('n(Number of frames)');
ylabel('Average number of nodes acquiring a time slot within n frames');
legend('Analysis','Simulation');
grid on;

%模型分析图(平均选到时隙的节点数)
figure(2)
plot(X,Y(1,:),'k-o');
hold on;
plot(X,Y(2,:),'k-*');
hold on;
plot(X,Y(3,:),'k-s');
hold on;
plot(X,Y(4,:),'k-d');
hold on;
plot(X,Y(5,:),'k-^');
hold on;
plot(X,Y(6,:),'k-v');
hold on;
xlabel('n(Number of frames)');
ylabel('Average number of nodes acquiring a time slot within n frames');
legend('N=20,K=17','N=20,K=12','N=20,K=7','N=15,K=15','N=15,K=10','N=15,K=5');
grid on;

%模型分析图(全部节点都选到时隙的概率)
figure(3)
plot(X,F(1,:),'k-o');
hold on;
plot(X,F(2,:),'k-*');
hold on;
plot(X,F(3,:),'k-s');
hold on;
plot(X,F(4,:),'k-d');
hold on;
plot(X,F(5,:),'k-^');
hold on;
plot(X,F(6,:),'k-v');
hold on;
xlabel('n(Number of frames)');
ylabel('\\itF^all_n');
legend('N=20,K=17','N=20,K=12','N=20,K=7','N=15,K=15','N=15,K=10','N=15,K=5');
grid on;

d126

 

以上是关于Markov的仿真的主要内容,如果未能解决你的问题,请参考以下文章

数字仿真定义、物理仿真定义,两者区别。

如何在保证仿真精度的情况下提高仿真速度

modelsim如何仿真

modelsim时序仿真时Run all只能到10740000ps,如何设置可以继续仿真啊?求助!

vcs仿真

Thinking in Java---多线程仿真:银行出纳员仿真+饭店仿真+汽车装配工厂仿真