How to plot the figure in the while loop ?
조회 수: 12 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
the cyclist
2021년 10월 4일
So, my suggestion was to change your code to this:
case 'JITTER & cs'
cs = linspace(2e-12 , 4e-12 , 10000)
J = linspace(0 , 5e-12 , 10000)
i =2; B_var=8;
figure
hold on
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);
plot(Noise_both,SNR);
title('SNR vs JITTER&cs')
B_var = 8+i;
end
but it is not possible to test this idea, because we don't have values for
A
Win
k
T
Psig
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!