MATLAB Answers

## ''Conversion to logical from sym is not possible.'' Please help

Asked by Anupam Ghosh

### Anupam Ghosh (view profile)

on 13 Mar 2018
Latest activity Commented on by Anupam Ghosh

### Anupam Ghosh (view profile)

on 14 Mar 2018
Accepted Answer by KSSV

### KSSV (view profile)

%This is a program on Continuous Fraction Expansion into a proper fraction using MATLAB. My program is attached...
clc; clear all;
syms s y z lo
% s=tf('s')
xy=1+(y*(s-1)/lo);
z=xy;
y=0.5;
lo=7;
n=3;
for m=6:-1:0
if mod(m,2)==0
lo=2+((n+y)*(s-1)/lo);
z=lo;
n=n-1;
else
xy=1+(y*(s-1)/lo);
lo=m+((n-y)*(s-1)/z);
% if m==6
% lo=7;
% end
end
end
disp('xy=')
pretty(xy)
% tf(xy)
% tol = 1.e-6*norm(xy(:),1);
[N,D] = rat(xy);
% fy=subs(xy,lo,7);
% disp('fy=')
% pretty(fy)

#### 0 Comments

Sign in to comment.

## 1 Answer

Answer by KSSV

### KSSV (view profile)

on 13 Mar 2018
Accepted Answer

You cannot use rat on the class sym. Use simplify instead.

Anupam Ghosh

### Anupam Ghosh (view profile)

on 14 Mar 2018
thanks, the program runs satisfactoryly...

Sign in to comment.