how to change title automatic ?

5 次查看(过去 30 天)
for exmaple I have this code :
ta = 0:1/4000:2/60; % analog time axis
f_sample=800;
xa1 = cos(2*pi*60*ta+pi/3);
xa2 = cos(2*pi*340*ta-pi/3);
xa3 = cos(2*pi*460*ta+pi/3);
tn = 0:1/f_sample:2/60; % discrete-time axis as n*Ts
xn1 = cos(2*pi*60*tn+pi/3);
xn2 = cos(2*pi*340*tn-pi/3);
xn3 = cos(2*pi*460*tn+pi/3);
subplot(3,1,1);
plot(ta,xa1)
hold on;;
stem(tn,xn1);
title('x1(t)- f_a_n_a_l_o_g=60 f_s_a_m_p_l_e=400');
legend('blue-countinous(analog) signal','orange-discrete signal');
xlabel('ferquincy-[Hz]');
ylabel('x_1(t),x_1[n]');
subplot(3,1,2);
plot(ta,xa2);
hold on;
stem(tn,xn2);
title('x2(t)- f_a_n_a_l_o_g=340 f_s_a_m_p_l_e=400');
legend('blue-countinous(analog) signal','orange-discrete signal');
xlabel('ferquincy-[Hz]');
ylabel('x_2(t),x_2[n]');
subplot(3,1,3);
plot(ta,xa3);
hold on;
stem(tn,xn3);
title('x3(t)- f_a_n_a_l_o_g=460 f_s_a_m_p_l_e=400');
xlabel('ferquincy-[Hz]');
legend('blue-countinous(analog) signal','orange-discrete signal');
ylabel('x_3(t),x_3[n]');
for example I want to change f_sample and that it will change in the title automatic without changing it manually every time . Is there a way ?
  1 个评论
Jan
Jan 2018-7-30
Most of the code does not concern the question. If you post the relevant part only, it would be less confusing.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2018-7-30
maybe you want:
title(sprintf('x1(t)- f_{analog}=60 f_{sample}=%d', fsample));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by