Matlab程序:错误在哪里建立函数文件fun5.mfunction dy=fun5(t,y)dy=[(-5*sin(t)*(5*cos(t)-y(1))+5*cos(t)*(5*sin(t)-y(2)))*(5*cos(t)-y(1))./((5*cos(t)-y(1))^2+(5*sin(t)-y(2))^2),(-5*sin(t)*(5*cos(t)-y(1))+5*cos(t)*(5*sin(t)-y(2)))*(5*sin(t)-
建立函数文件fun5.m
function dy=fun5(t,y)
dy=[(-5*sin(t)*(5*cos(t)-y(1))+5*cos(t)*(5*sin(t)-y(2)))*(5*cos(t)-y(1))./((5*cos(t)-y(1))^2+(5*sin(t)-y(2))^2),
(-5*sin(t)*(5*cos(t)-y(1))+5*cos(t)*(5*sin(t)-y(2)))*(5*sin(t)-y(2))./((5*cos(t)-y(1))^2+(5*sin(t)-y(2))^2)]
主程序:
clear,clc
close all
[t,y]=ode45('fun5',[0,100],[10,0]);
X=5*cos(t);
Y=5*sin(t);
figure(1)
plot(X,Y,'r.')
hold on
plot(y(:,1),y(:,2),'*')
标量乘向量还是用点乘吧.
把所有*改成 .*试试行不?
function dy=fun5(t,y)
dy=[(-5.*sin(t)*(5.*cos(t)-y(1))+5.*cos(t)*(5.*sin(t)-y(2)))*(5.*cos(t)-y(1))./((5.*cos(t)-y(1))^2+(5.*sin(t)-y(2))^2),
(-5.*sin(t)*(5.*cos(t)-y(1))+5.*cos(t)*(5.*sin(t)-y(2)))*(5.*sin(t)-y(2))./((5*cos(t)-y(1))^2+(5.*sin(t)-y(2))^2)];
clear,clc
close all
[t,y]=ode45('fun5',[0,100],[10,0]);
X=5.*cos(t);
Y=5.*sin(t);
figure(1)
plot(X,Y,'r.')
hold on
plot(y(:,1),y(:,2),'*')
在坐标平面上有两个区域M和N,M是由y≥0、y≤x和y≤2-x三个不等式来确定的,N是随t变化的区 2020-05-13 …
刘老师. 已知α是三维非零列向量 αT是α转置. 解答里说αTα是秩为1的三阶矩阵 为什么?刘老师 2020-05-15 …
数学归纳法可不可以假设k和k-1同时成立?已经得出递推式是Tn=T(n-1)+2*T(n-2),要 2020-05-20 …
下列词语中加点的字,读音全都正确的一组是()(3分)A.剜肉(wān)岑寂(céng)蟊贼(máo 2020-07-02 …
下列词语中,字的字音正确的一项是A.迤逦(lǐ)憎(zēnɡ)恶坍(tān)缩命途多舛(chuǎn 2020-07-23 …
已知曲线上一点(x,y),过该点做曲线的法向量n,切向量t.请问为什么cos(n,x)=cos(t 2020-07-30 …
数列an满足递推式(a(n+2))*an-(a(n+1))^2=(t^n)*(t-1),a1=1, 2020-08-01 …
初高中衔接书上的几道比例线段的题,a/x=t/t+m,a/b=t/t+m+n联立两式,消去t,得x 2020-08-02 …
如果x(m+n)-2y(n-1)+4z(t-m)=0是关于x、y、z的三元一次方程则m=(),n=( 2020-10-31 …
某种放射性元素的原子数N随时间t的变化规律是某种放射性元素的原子数N随时间t变化规律是:N=N0e^ 2020-12-30 …