Matlab谱图,黄油和滤波器功能问题

时间:2015-06-23 17:00:21

标签: matlab function filter

  1. 如何更改光谱图的颜色以显示更接近紫色的强度和更接近红色的强度?

  2. 如何将黄油和过滤功能应用于wav文件以显示:

    • 4500hz的低通切割频率
    • 带有中心强度为3000赫兹且带宽为1000赫兹
    • 的带状阻尼器
  3. 然后在分光光度计中显示这个滤波后的信号?

2 个答案:

答案 0 :(得分:1)

以下Matlab代码应该做你想要的。过滤器设计的参数定义为变量,可以更改以调整过滤器。 如果您希望将图分开,只需删除import UIKit class TableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchResultsUpdating { @IBOutlet var tabeView: UITableView! var countryPicker = ["Colombia", "England", "France", "Germany", "Brazil", "Austria", "Spain", "Australia", "USA", "Berlin", "Thailand", "Northern Ireland", "New Zealand", "Hawaii", "Switzerland", "Sweeden", "Finland", "Turkey", "Russia", "Netherlands", "Japan"] override func viewDidLoad() { super.viewDidLoad() countryPicker.sort(){$0 < $1} } func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return countryPicker.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("UITableViewCell", forIndexPath: indexPath) as! UITableViewCell cell.textLabel?.text = countryPicker[indexPath.row] return cell } 并将subplot(3,1,x)放在figure之前。那么你将有三个单独的情节。

要使用spectrogram - 文件,请删除加载示例数据的行,并使用.wav - 命令取消注释该行。

audioread

产生以下结果:

Spectrograms

答案 1 :(得分:0)

好的,我将更好地举例说明评论部分讨论的内容。希望这个对你有帮助。基本上有一个嘈杂的正弦信号。我制作了一个频谱图,然后将一些噪声滤除,并制作另一个频谱图来显示滤波结果。

x = 0:0.001:4*pi;
y = sin(x);
y2 = wgn(1,length(x),0.5);
y3 = sin(314*x);
y4 = y+y3+y2;

figure(1)
plot(x,y4);

nfft = 2^nextpow2(length(y4));
[S,F,T,P] = spectrogram(y4,250,50,nfft,1000);

figure(2)
spectrogram(y4,250,50,nfft,1000);

%create filter and use it on the noisy signal
[b,a] = butter(4,0.5,'low');
y5 = filtfilt(b,a,y4);

figure(3)
spectrogram(y5,250,50,nfft,1000);

以下是生成的图表:

enter image description here

enter image description here

enter image description here

正如您所看到的,频谱图调用具有所使用颜色的默认缩放,您可以通过图形手柄改变颜色,如果您想知道如何操作,我会在SO上提出另一个问题或者谷歌吧。

请注意评论部分中Matt的建议警告您需要确定如何过滤wav文件。