顯示具有 matlab 標籤的文章。 顯示所有文章
顯示具有 matlab 標籤的文章。 顯示所有文章

2022年7月20日 星期三

Matlab 影片轉音樂+ 裁減

一陣子沒po宅宅文, 來po一個最近玩過的

最近想要把影片的音樂取出然後裁減, 可以做手機鈴聲之類的

在網路上找了一些免費的工具, 看來看去都沒有很合用,

所以就動起來用  Matlab 來搞的想法

其實非常簡單, 很土炮就是


完整程式碼在底下, 自行取用


///

%讀影片檔

[y,Fs] = audioread('filename.MOV');

%畫出來看看, 才能知道要切哪一段, 用Markt 標出來

%這邊的x軸不是時間軸, 但可以自己做一條x時間軸 

plot(y)

% 切這一段

y=y(12345:67890);

% 聽看看

sound(y,Fs)

% 都沒錯就能存檔了

audiowrite(['filename.wav'],y,Fs);



2021年7月10日 星期六

make a nice-looking figure in Matlab for IEEE papers

 make a nice-looking figure in Matlab for IEEE papers

I constantly am asked how to make a good, nice-looking figure in Matlab for IEEE papers. I have my personal taste and own receipt. It looks quite decent from my point of view. FYI. if you have another taste, feel free to share with me.


Here is the receipt:

  • Import your data of course, e.g. variables x and y
  • create a new figure
    • fig=figure(1) 
      • Key point is that DO NOT modify the window size. 
      • Keep the size as default
  • Plot data
    • plot(x,y,'b-','LineWidth',2)
      • Use Linewidth to be 2
      • Linestyle is up to you
  • Export the figure in EPS format which is fully supported by LaTeX
    • you can use "save as.." in the menu of the figure 
    • or use command saveas(fig,'fig.eps')


Simple as that.  

Enjoy plotting figures.