声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2057|回复: 1

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

[复制链接]
发表于 2006-5-27 07:47 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
用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=[K*sin(theta3) 1/r2;-Kcos(theta3) 0];
C=[-sin(theta2)-cos(theta2)-K*cos(theta3)];cos(theta2)-sin(theta2)-K*sin(theta3)];
y=inv(T)*C*[alpha2;omega2^2;omega3^2];

仿真运行函数是这样的:
%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([K*sin(theta30) 1/r2; -K*cos(theta30) 0])*[-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.

请大虾帮帮忙啊!!谢谢!!!
1.GIF
回复
分享到:

使用道具 举报

发表于 2006-5-27 10:50 | 显示全部楼层
数据的维数不对,从编程来看y是一个1*3的句阵,输出却是两个信号分流
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-26 00:52 , Processed in 0.056832 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表