how to change title automatic ?

10 visualizaciones (últimos 30 días)
tomer polsky
tomer polsky el 30 de Jul. de 2018
Comentada: tomer polsky el 30 de Jul. de 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 comentario
Jan
Jan el 30 de Jul. de 2018
Most of the code does not concern the question. If you post the relevant part only, it would be less confusing.

Iniciar sesión para comentar.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by