bandwidth at certain height
1 次查看(过去 30 天)
显示 更早的评论
I am new to Matlab and hope someone can help me out. I try to get the bandwidth at certain reading of a peak, and write the following code. But run into a few problems. The codes are follows.
%%%read in data%%%
origindata=importdata('rawdata.txt');
f=origindata(:,1);
a=origindata(:,2);
b=origindata(:,3);
c=origindata(:,4);
d=origindata(:,5);
%%%start count y%%%
y=0;
%%%start loop t for calculation%%%%
for t=(0.1:0.1:20)
e=a-j*b;
u=c-j*d;
rl=u.*e.*f*t;
%%%save results%%%
y=y+1;
y1(:,3*y-2)=f;
y1(:,3*y-1)=rl;
y1(:,3*y)=t;
%%%calculate peak width%%%
RLmax=min(rl);
w1=f(f(abs(rl+10)<0.1)<f(rl==RLmax));
w2=f(f(abs(rl+10)<0.1)>f(rl==RLmax));
width=w2-w1;
%%%save peak width in z1%%%
z1(y,1)=t;
z1(y,2)=f(rl==RLmax);
z1(y,3)=RLmax;
z1(y,4)=w1;
z1(y,5)=w2;
z1(y,6)=width;
hold on;
end;
xlswrite('y1',y1);
xlswrite('z1',z1);
I got this:
"Unable to perform assignment because the size of the left side is 1-by-1 and the size of the
right side is 0-by-1."
It seemed the following codes caused problem, as I removed them and related, it ran ok.
w1=f(f(abs(rl+10)<0.1)<f(rl==RLmax));
w2=f(f(abs(rl+10)<0.1)>f(rl==RLmax));
width=w2-w1;
But I need to extract those information. Can anyone help me out? Thank you.
2 个评论
Walter Roberson
2020-7-17
more than one entry can equal the min.
It is not obvious that any entries will meet the abs() compared to f() test.
That section of code is too complicated for other people to to be expected to understand. Break it up into separate lines with comments.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!