Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

why i get this error (Undefined function or method 'fptintf' for input arguments of type 'sym'. Error in ==> trying at 34 ;fptintf(fid,' %1.2s\n',r1);)and how to solve it

1 vue (au cours des 30 derniers jours)
Ahmed Helmi
Ahmed Helmi le 12 Mai 2016
Clôturé : MATLAB Answer Bot le 20 Août 2021
clear;clc t = input('write the time = ');
s = input('write the time step = ');
L1 = input('first link lenght = ');
L2 = input('second link lenght = ');
L3 = input('third link lenght = ');
m = L1+L2+L3; %the sum of the links lenght
p = t/s ;% the time step
w = m/p; % number of parts for every axies
syms th1 th2 th3
A1 = [cos(th1) -sin(th1) 0 L1*cos(th1) ;
sin(th1) cos(th1) 0 L1*sin(th1);
0 0 1 0 ; 0 0 0 1];
A2 = [cos(th2) -sin(th2) 0 L2*cos(th2) ;
sin(th2) cos(th2) 0 L2*sin(th2);
0 0 1 0 ; 0 0 0 1];
A3 = [cos(th3) -sin(th3) 0 L3*cos(th3) ;
sin(th3) cos(th3) 0 L3*sin(th3) ;
0 0 1 0 ; 0 0 0 1];
fid = fopen('Matlab-Asm1.doc','w');
u = 0;
for q = 0:s:t ;
px = m-w*u ;py = w*u ;pz = 0;
M = [0 0 0 px ; 0 0 0 py ; 0 0 1 pz ; 0 0 0 1];
S = inv(A1)*M;
r1 = solve(S(2,4),th1);%r1 is th1
s1 = subs(S,th1,r1);
S1 = inv(A2)*s1;
r2 = solve(S1(2,4),th2);%r2 is th2
s2 = subs(S1,th2,r2);
S2 = inv(A3)*s2;
r3 = solve(S2(2,4),th3);%r3 is th3
fprintf(fid,'%1.2f',q);fprintf(fid,' %1.2f',px);fprintf(fid,' %1.2f',py)...
;fptintf(fid,' %1.2s\n',r1);
u = u+1;
end

Réponses (1)

Elias Gule
Elias Gule le 13 Mai 2016
There's a typo in your code. The line before
u = u + 1;
must be changed from
; fptintf(fid,' %1.2s\n',r1);
to
;fprintf(fid,' %1.2s\n',r1);

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by