tdafa 发表于 2006-5-27 07:47

[求助]混合编程时的错误,高手帮忙看一下!

用matlab 跟simlink做一个驱动机构的仿真,仿真是这样的
其中qbfun函数是这样的:

function y=qbfun(u)
%本程序用于驱动机构仿真模块的配套使用
K=u(1);r2=u(2);alpha2=u(3);omega2=u(4);omega3=u(5);theta2=u(6);theta3=u(7);
T=;
C=[-sin(theta2)-cos(theta2)-K*cos(theta3)];cos(theta2)-sin(theta2)-K*sin(theta3)];
y=inv(T)*C*;

仿真运行函数是这样的:
%clear all;
%初值设定----------------------------------------------------------------------
K=3.8;r=2500;r2=0.196/2; T=4/2;r10=-r2*2;
alpha2=0;omega20=r*pi/30;theta20=-pi;theta30=0;
v10=inv()*[-omega20*sin(theta20);omega20*cos(theta20)];
omega30=v10(1);v10=v10(2);
%仿真模块运行与处理--------------------------------------------------------------
t=sim('qb',[-30/r,30/r]); t=t*1000;
a=simout(:,1);v=simout(:,2);o=simout(:,3)*180/pi;s=simout(:,4)*1000;
flag=find(t>=T);flag=min(flag);lflag=s(flag)
subplot(2,2,1);plot(t,a,'linewidth',2);axis tight;grid on;
xlabel('\fontsize{8}\bft (ms)');ylabel('\fontsize{8}\bfa (m/s^{2})');title('\fontsize{8}\bft-a曲线');
subplot(2,2,2);plot(t,v,'linewidth',2);axis tight;grid on;
xlabel('\fontsize{8}\bft (ms)');ylabel('\fontsize{8}\bfv (m/s)');title('\fontsize{8}\bft-v曲线');
subplot(2,2,3);plot(t,s,'linewidth',2);axis tight;grid on;
xlabel('\fontsize{8}\bft (ms)');ylabel('\fontsize{8}\bfs (mm)');title('\fontsize{8}\bft-s曲线');
subplot(2,2,4);plot(t,o,'linewidth',2);axis tight;grid on;
xlabel('\fontsize{8}\bft (ms)');ylabel('\fontsize{8}\bf\theta (^{0})');title('\fontsize{8}\bft-\theta曲线');

直接运行sim 会出现这样的错误消息:
Unable to determine signal dimensions. There is a loop consisting of 'qb/qbfun' that cannot be resolved because signal dimensions are defined by a cyclic relationship. Specifying the signal dimensions on Inport, Mux, Selector, Demuxes will help resolve signal dimensions in the loop. You can also use the Signal Specifications to define the signal dimensions.

请大虾帮帮忙啊!!谢谢!!!

branch 发表于 2006-5-27 10:50

数据的维数不对,从编程来看y是一个1*3的句阵,输出却是两个信号分流
页: [1]
查看完整版本: [求助]混合编程时的错误,高手帮忙看一下!