From: roy michaeli on
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.

Error in ==> reaction at 14
rs=[j1 j2 ; 1 1] \[t1 ; t2]

Error in ==> project at 4
[r1,r2]=reaction(fl,fs,j1,j2,q,leng)
>>

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
q=[input('function of force'),'+x.*0']
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(fl,fs,q,leng,j1,j2)
q=num2str(q)
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;
d=trapz(x,eval(q))
t1=sum(ff)+a
t2=sum(fs)+d
rs=[j1 j2 ; 1 1] \[t1 ; t2]
r1=-rs(1,1)
r2=-rs(2,1)
end

Thanks in advance.
Roy Michaeli.
From: roy michaeli on
I am sorry.. I had the same problem twice and I did not notice it.
It's all about the order of the vars.
Thanks a lot.