Matlab 来自多个电池的近似实验数据
我有几个单元格数组,其中包含.mat文件中的探测数据 我需要找到1000个输入中每一个的共振频率和q因子,然后估计(近似)它们。但是,下面的代码仅提供1个fres值,而不是1000,并且没有显示(i,fres)的绘图Matlab 来自多个电池的近似实验数据,matlab,indexing,mat-file,Matlab,Indexing,Mat File,我有几个单元格数组,其中包含.mat文件中的探测数据 我需要找到1000个输入中每一个的共振频率和q因子,然后估计(近似)它们。但是,下面的代码仅提供1个fres值,而不是1000,并且没有显示(i,fres)的绘图 FStart-单元阵列(1000*1) FEnd-单元阵列(1000*1) 放大器-多阵列(1000*100) 注意:最后一个FStart值小于第一个frequend值 此外,我尝试将Q因子视为:Max(电平上的频率=1/2*maxampliance)-Min(电平上的频率=
- FStart-单元阵列(1000*1)
- FEnd-单元阵列(1000*1)
- 放大器-多阵列(1000*100)
您能告诉我,这里有什么问题吗?除了对您的答案的注释清楚地显示了问题所在之外,您还可以通过将
fres
存储为向量从脚本中删除plot
:
for i = 1:1000
f1 = FStart(i):10:FEnd(i);
grid on
y1 = plot(f1,Amp(i,:));
[maxValue, maxIndex] = max(Amp(i,:)); %find maximum value of amplitude for each i
[Q_Value, Q_Index] = max(0.5*Amp(i,:)); %also tried 0.5*max() and /2
fres(i) = f1(maxIndex); %by index of max amplitude value find resonance frequency
end
plot(1:1000,fres,'ko-','LineWidth',2)
i
是一个标量,因此plot(i,fres)
在图形上绘制一个点,没有标记就不会显示任何内容。若要查看某些内容,请尝试plot(i,fres,“*”)
使用星号标记进行绘图Q_索引
是一个单独的索引,它被重新分配给每个循环迭代器,因此f2(Q_索引)
也是一个单独的数字,因此fmin=fmax
fmin = min(f2(Q_Index))
fmax = max(f2(Q_Index))
for i = 1:1000
f1 = FStart(i):10:FEnd(i);
grid on
y1 = plot(f1,Amp(i,:));
[maxValue, maxIndex] = max(Amp(i,:)); %find maximum value of amplitude for each i
[Q_Value, Q_Index] = max(0.5*Amp(i,:)); %also tried 0.5*max() and /2
fres(i) = f1(maxIndex); %by index of max amplitude value find resonance frequency
end
plot(1:1000,fres,'ko-','LineWidth',2)