how to change title automatic ?

9 Ansichten (letzte 30 Tage)
tomer polsky
tomer polsky am 30 Jul. 2018
Kommentiert: tomer polsky am 30 Jul. 2018
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 Kommentar
Jan
Jan am 30 Jul. 2018
Most of the code does not concern the question. If you post the relevant part only, it would be less confusing.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 30 Jul. 2018
maybe you want:
title(sprintf('x1(t)- f_{analog}=60 f_{sample}=%d', fsample));
  1 Kommentar
tomer polsky
tomer polsky am 30 Jul. 2018
that is exactly what I meant !!! thank you very much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by