From: roy michaeli on 8 Jun 2010 10:53 hello to you all. i am getting the error: ??? Undefined function or method 'eval' for input arguments of type 'double'. Error in ==> reaction at 6 a=trapz(x,x.*eval(q)) Error in ==> project at 4 [r1,r2]=reaction(fl,fs,j1,j2,q,leng) it seems like the transfer of the vars between the function does not work well.. The var q changes it's value from the string 'x+0.*x' to (9) thanks in advance. roy clc clear all [fl,fs,q,leng,j1,j2]=kelet [r1,r2]=reaction(fl,fs,j1,j2,q,leng) function [fl,fs,q,leng,j1,j2]=kelet a=0; k=1; leng=input('please enter length: ') j1=input('please enter position of 1st joint: ') j2=input('please enter position of 2nd joint: ') if j1>j2 temp=j1 j1=j2 j2=temp end q1=input('function of force') q2='+x.*0' q=[q1,q2] while a==0 dummy=input('please enter position of force: ') if dummy<=leng fl(1,k)=[dummy]; fs(1,k)=[input('please enter size of force: ')] k=k+1; else a=1; end end function [r1 r2]=reaction(leng,fl,fs,q,j1,j2) s=size(fl) s=s(2) ff=fl.*fs x=0:0.01:leng; a=trapz(x,x.*eval(q)) x=0:0.01:leng; %reactions x=0:0.01:leng; rs=[j1 j2 ; 1 1]\[sum(ff)+a ; sum(fs)+trapz(x,eval(q))] r1=-rs(1,1) r2=-rs(2,1) end
|
Pages: 1 Prev: exist() for a substructure Next: searching inside a matrix column |