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

3 views (last 30 days)
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;

Answers (1)

Jan
Jan on 8 Jan 2019
Edited: Jan on 8 Jan 2019
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 Comments
Jan
Jan on 10 Jan 2019
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.

Sign in to comment.

Categories

Find more on Time Series in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!