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^2+4x+1(4ac-b^2)/4a是怎么来的,帮忙解答一下.谢谢!(1)y=-x 2020-04-07 …
整式的乘法6题~1.x^2-y^2-x+y=(x-y)A,则A=.2.已知2^x=3,2^y=5, 2020-04-27 …
20-4Y+5Y=234X+5Y=23 X+Y=5 由X+Y=5得X=5-Y 将X=5-Y代入4X 2020-05-13 …
mathematica8.0中如何求带根号的函数最小值,函数为z=10Sqrt[(x-1)^2+( 2020-06-02 …
4(x-y-1)=3(1-y)-2;x/2+y/3=2方程组的解,把①4(x-y-1)=3(1-y 2020-06-21 …
12道很难《六年级》得分数计算不怕得来!我有352分先给20分之后+50分《/是分数线》5/2-5/ 2020-10-31 …
1.已知x=7/2(√7+√5).y=1/2(√7-√5)求下列各式值.(1)x^2-xy+y^2( 2020-11-01 …
能简则简.(1)3/4+3/4÷3(2)1/3÷1/2-5/4x2/5(3)4/9÷[5/9-能简则 2020-11-26 …
解下列方程组.恩呢,谢谢哈记得带算式哦哦一、3x(y-1)=4x(x+5)5x(x-1)=3x(y+ 2020-12-24 …
将一颗骰子投掷两次分别得到点数a、b,则直线ax-by=0与圆x2+(y-5)2=5相切的概率为—— 2020-12-30 …