用八度音阶/Matlab查找在哪些地方可以相交 [英] Finding where plots may cross with octave / matlab
问题描述
下面有几个数据点,当幅度值超过 4 时,我想找到频率值.我在下面的示例中提供了一个示例以及数据点.我已经以图形方式圈出了答案,但是我不确定如何进行数学计算并获得所需频率的所有值.如何使用八度音阶/Matlab做到这一点?还有我要做什么的数学术语吗?
I have several data points that are plotted below and I would like to find the frequency value when the amplitude value crosses 4. I've included an example along with the data points in the example below. I've circled the answer graphically but I'm not sure how to compute it mathematically and get all the values for the frequencies I desire. How can I do this with octave / matlab? Also is there a mathematical term for what I'm trying to do?
在此示例中,我尝试获取5个频率(但这只是一个示例),我知道两个答案是 30 和 80 ,但不确定如何获取其余的部分.完整列表可能是数千个. 我正在使用八度3.8.1
In this example I'm trying to get 5 frequencies (but this is just an example) I know two answers are 30 and 80 but not sure how to get the rest. The full list could be thousands. I'm using octave 3.8.1
clear all,clf, clc,tic
%graphics_toolkit gnuplot %use this for now it's older but allows zoom
freq=[20,30,40,50,60,70,80];
amp_orig=[2,4,3,7,1,8,4];
amp_inv=[6,4,5,1,7,0,4];
plot(freq,amp_orig,'-bo')
hold on
plot(freq,amp_inv,'-r*')
xlabel ("Frequency");
ylabel ("Amplitude");
谢谢
推荐答案
尝试此功能(来自文件交换),在Octave中似乎可以正常使用. x0
是感兴趣的频率:
Try this function from the File Exchange, it seems to work just fine in Octave. x0
are the frequencies of interest:
>> [x0,y0,iout,jout] = intersections(freq,amp_orig,freq,amp_inv)
x0 =
30.000
30.000
42.500
55.000
64.286
80.000
y0 =
4.0000
4.0000
4.0000
4.0000
4.0000
4.0000
iout =
2.0000
2.0000
3.2500
4.5000
5.4286
7.0000
jout =
2.0000
2.0000
3.2500
4.5000
5.4286
7.0000
这篇关于用八度音阶/Matlab查找在哪些地方可以相交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!