How to plot the figure in the while loop ?

1 次查看(过去 30 天)
SU PIN-YAN
SU PIN-YAN2021-10-4
评论: SU PIN-YAN ,2021-10-5
I want to plot the figure when the data is runned 10000 data ,and intergrate the four figure in one(about 8bit 10bit 12bit 14bit) .
when run 1 data , it's will be plot one figure but that's not my want . please help my code , thanks !
below is my code :
case 'JITTER & cs'
cs = linspace(2e-12 , 4e-12 , 10000)
J = linspace(0 , 5e-12 , 10000)
i =2; B_var=8;
while B_var < 15
Delta_var = (A^2)/(2^B_var);
QN = (Delta_var^2)/12;
JITTER = ((A^2)*(Win^2)*(J.*J))/2;
TN = k*T./cs;
Noise_both = JITTER+TN;
func = Psig./(QN+Noise_both);
SNR = 10*log10(func);
hold on;
figure;
plot(Noise_both,SNR);
title('SNR vs JITTER&cs')
B_var = 8+i;
end

回答(1 个)

the cyclist
the cyclist 2021-10-4
Try putting the figure command and the hold on commands before the while loop (and put the figure command before the hold on).
If you paste your code here -- instead of an image of your code -- it would be easier to help, because we could run your code without needing to retype it all.
  4 个评论
SU PIN-YAN
SU PIN-YAN 2021-10-5
that's good ! the code can work and that's what I want to do , thanks !

请先登录,再进行评论。

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by