How to plot the figure in the while loop ?

1 view (last 30 days)
SU PIN-YAN
SU PIN-YAN on 4 Oct 2021
Commented: SU PIN-YAN on 5 Oct 2021
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

Answers (1)

the cyclist
the cyclist on 4 Oct 2021
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 Comments
SU PIN-YAN
SU PIN-YAN on 5 Oct 2021
that's good ! the code can work and that's what I want to do , thanks !

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by