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),'*')
下列函数中,哪些是一次函数?哪些是正比例函数?为什么?(1)y=-x+1/5(2)y=-x/5(3) 2020-03-30 …
已知一次函数y=kx+1与y=-0.5+b已知函数Y=KX+1与Y=-0.5+B的图像交于点(2, 2020-04-08 …
Matlab程序:错误在哪里建立函数文件fun5.mfunction dy=fun5(t,y)dy 2020-05-16 …
命题“若x=3,y=5,则x+y=8”的否命题是"若x=3,y=5"可不可以理解为“若x=3且y= 2020-06-03 …
一个西方经济学的问题,当两种商品X、Y的效用函数为U(X,Y)=XY/3时,下列哪一种效用函数描述 2020-06-05 …
0.5^x=x我想了好久!指数函数y=0.5^x和对数函数y=log0.5x的交点怎么求?就是方程 2020-07-20 …
用matlab,已知x的值,和f(x,y)=0的隐函数,如何求y已知x=linspace(-2.23 2020-11-01 …
将下面程序中的函数用inline函数改写如何做?functiondemo1%主函数x=-5:0.3: 2020-11-01 …
求“当Y>0,N=42-3*Y;当-5≤Y≤0,N=45-|(Y+3)|;当Y<-5,N=43+2* 2020-11-01 …
若x1满足2x+2^x=5,x2满足2x+2log2(x+1)=5,求x1+x2=多少?2X+2^x 2020-11-19 …