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),'*')
已知函数f(x)对于任意s,t属于R都有f(s+t)-f(t)=(s+2t+1)s,且f(1)=0( 2020-03-31 …
有关数学映射和排列的一个问题已知X属于{1,2,3,4,5},F(X)={6,7,8},求:符合F 2020-06-04 …
看一道函数解答题(超简单的)已知f(x+1)=x^2+2x,求f(x)令x+1=t,则t=x-1所 2020-06-06 …
已知定义域为R的函数f(x)在区间(-∞,5)上单调递减,对任意实数t,都有f(5+t)=f(5- 2020-06-25 …
函数f(x)=ax+b/1+x²是定义在(-1,1)上的奇函数,且f(1/2)=2/5(1)解析式 2020-07-04 …
对于积分上限函数∫(a,t)f(y)dy,知道被积函数是f(t).那么对于∫(a,t)f(x+y) 2020-08-02 …
设函数y=f(x)是定义在(0,+∞)上的增函数,并满足f(xy)=f(x)+f(y),f(4)=1 2020-11-01 …
设二次函数f(x)=ax2+bx+c(a.b.c∈R)满足条件:①当x∈R时,其最小值为0,且f(x 2020-11-01 …
关于函数已知定义域为r的函数f(x)在区间(-∞,5)上单调递减对任意实数t都有f(5+t)=f(5 2020-12-08 …
已知向量a=(12,12rint+c2tort)与b=(1,5)共线,设函数5=f(t)(1)求函数 2021-01-09 …