Print a value on a plot

조회 수: 16 (최근 30일)
BP
BP 2022년 3월 23일
댓글: Davide Masiello 2022년 3월 24일
I am measuring and ploting the 10 to 90% risetime of a pulse. I need to put the value of the risetime on the plot. Below is my code. The value I need to print on the plot is RTC
for k1 = 1:2
RTC=risetime(xcr,tcr);% "risetime(x,t)" is the 10 to 90% risetime of the closed circuit pulse.
end
figure('DefaultAxesFontSize',4);%create a figure 10 for the closed circuit rise time plot
grid on;
risetime(xcr,tcr);
xlim([-0.01e-7, 0.015e-6]);
ylabel('Voltage (kV)')
xlim([2.9*1e-7 3.5*1e-7]);% center the rise time wave
legend('Closed (loaded) circuit 10 to 90% Rise Time');

답변 (1개)

Davide Masiello
Davide Masiello 2022년 3월 23일
편집: Davide Masiello 2022년 3월 23일
I'd recommend taking a look at this
Make sure to use num2str to convert the number into text.
  댓글 수: 2
BP
BP 2022년 3월 23일
I changed my code to the following. Now it prints the test "Rise Time(s)" in the correct place on the plot. I need it to print the actual value of "s" where is prints "(s).
for k1 = 1:2
RTC=risetime(xcr,tcr);% "risetime(x,t)" is the 10 to 90% risetime of the closed circuit pulse.
end
%Plot 8
figure('DefaultAxesFontSize',4);%create a figure 10 for the closed circuit rise time plot
grid on;
risetime(xcr,tcr);%Put this data in the plot
s = num2str(RTC);
text(3.1e-7,32,'Rise Time(s)');
xlim([-0.01e-7, 0.015e-6]);% set the x min/max and y min/max in this order.--xlim([-1.45e-7, -1.39e-7]) Note: the Y azis will not plot below 0
ylabel('Voltage (kV)')
xlim([2.9*1e-7 3.5*1e-7]);% center the rise time wave
legend('Closed (loaded) circuit 10 to 90% Rise Time');
Davide Masiello
Davide Masiello 2022년 3월 24일
Change it like this
text(3.1e-7,32,s);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by