for example:

for i=1:3
 subplot(3,1,i);
 plot(t,imf1(i,:));
 xlim([0 (n-1)/fs]);
 ylim([-2 2]);
title('第r(i)个IMF');
end 

MATLAB中如何给一个循环语句标注题目

为了使这个循环语句中图的标题也是循环实现的,即名字和循环 i 有关,用上面的title('第r(i)个IMF');显然不能实现。

原因是:tittle(‘ ’);‘ ’中不能是变量

 这时,

 应该使用num2str函数将循环变量改为string类型。使用strcat将多个string连接。

 titleName = strcat('第',num2str(i),'个IMF分量');

 title(titleName);

相关文章:

  • 2021-11-27
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2021-11-16
  • 2021-11-28
猜你喜欢
  • 2022-01-07
  • 2021-11-17
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-04-30
相关资源
相似解决方案