How do i solve this error: Undefined operator '>' for input arguments of type 'timeseries'.

3 次查看(过去 30 天)
f1=0;
f2=0;
nb=8;
dt=0.000002;
bsf=50.89;
phi_do=4.7124;
k=6;
x=0.002;
ro=0.0179;
ri=0.0112;
slip=0.01;
wc=157.0796;
phi0=0;
Cdr=0.0012;
Cdi=7.4219e-04;
Cdo=4.5265e-04;
Cd=0.004;
c=5e-6;
kb=1.8978e+12;
for j=1:nb
phi=(2*pi*(j-1))/nb+wc*dt+phi0+(0.5-rand)*slip;
phis=bsf*dt+phi_do;
if j==k && phis>0 && phis<x/ro
b=1;
elseif j==k && phis>pi && phis<pi+x/ri
b=(Cdr+Cdi)/(Cdr-Cdo);
else
b=0;
end
d=(xs-xp)*cos(phi)+(ys-yp)*sin(phi)-c-b*Cd;
if d>0
gam=1;
else
gam=0;
end
f1=f1+gam*abs(d)^1.5*cos(phi);
f2=f2+gam*abs(d)^1.5*sin(phi);
fx=kb*f1;
fy=kb*f2;

回答(1 个)

Jan
Jan 2019-1-8
编辑:Jan 2019-1-8
The only places, where ">" occurs are:
phis>0, phis>pi, d>0
When I run your code, I get the error message, that xs is undefined. I guess, that you have defined it anywhere else as a timeseries object. The the error message will occur for d>0. If you post the complete error message instead of mentioning a short part only, it would be clear, where the problem occurs.
  2 个评论
Jan
Jan 2019-1-10
Yes, Rk, these variables are defined elsewhere, but we cannot guess how they are defined. Obviously their type causes d to be a timeseries object, such that the >0 operation is not defined. Now it is your turn to find out, what is happening and what you want to achieve.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by