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

조회 수: 1 (최근 30일)
Rk
Rk 2019년 1월 8일
댓글: Jan 2019년 1월 16일
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
Walter Roberson
Walter Roberson 2019년 1월 10일
What are class(xs), class(xp), class(ys), class(yp) ?
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