bandwidth at certain height

2 visualizaciones (últimos 30 días)
addy fang
addy fang el 13 de Jul. de 2020
Comentada: addy fang el 21 de Jul. de 2020
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 comentarios
Walter Roberson
Walter Roberson el 17 de Jul. de 2020
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.
addy fang
addy fang el 21 de Jul. de 2020
Ok. Thank you.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by