Info
此问题已关闭。 请重新打开它进行编辑或回答。
still having error: Error using sin Not enough input arguments.
3 次查看(过去 30 天)
显示 更早的评论
still having error: Error using sin
Not enough input arguments.still havin error: Error using sin
Not enough input arguments.
clear all; close all; clc; %#ok<CLALL>
c=5.916;
h=35;
a=-11.5;
b=180;
q1=0;
q2=0;
p1=0.2;
E=0.2;
p2=sqrt(2*E- p1^2)
K=[0 0.0189 0.0190 2.2];
m=length(K);
dt=1/5;
tspan=[100:dt:1000];
for c=1:m;
[t{c},x{c}]=ode23tb(@(t,x)HB(t,x,c,h,a,b,K(c)),tspan,[q1 q2 p1 p2]);
end
X1=x{:,1};
X2=x{:,2};
X3=x{:,3};
X4=x{:,4};
subplot(2,2,1)
plot(X1(:,1),X1(:,3),'b',X1(:,2),X1(:,4),'r','LineWidth',5.0)
ax = gca;
ax.FontSize = 20; % Font Size of 15
legend('P','q')
title('(a)')
ylabel("P")
xlabel("q")
subplot(2,2,2)
plot(X2(:,1),X2(:,3),'b',X2(:,2),X2(:,4),'r','LineWidth',1.2)
ax = gca;
ax.FontSize = 20; % Font Size of 15
title('(b)')
ylabel("P")
xlabel("q")
subplot(2,2,3)
plot(X3(:,1),X3(:,3),'b',X3(:,2),X3(:,4),'r','LineWidth',1.2)
ax = gca;
ax.FontSize = 20; % Font Size of 15
title('(c)')
ylabel("p")
xlabel("q")
subplot(2,2,4)
plot(X4(:,1),X4(:,3),'b',X4(:,2),X4(:,4),'r','LineWidth',1.5)
ax = gca;
ax.FontSize = 20; % Font Size of 15
function dxdt = HB(t,x,b,c,a,h,K)
dxdt = zeros(4,1);
dxdt(1) = x(3);
dxdt(2) = x(4);
dxdt(3) =-(((2*h*sin*x(1))/((cos)^3*(x(1))))+((c*(cos^2)*x(1)+2*(sin)^2*x(1))/((cos)^3*x(1)))-(b*(sin)*2*x(1))+(a*(cos)*x(1)))+ K*(x(2)-x(1));
dxdt(4) =-(((2*h*sin*x(2))/((cos)^3*(x(2))))+((c*(cos^2)*x(2)+2*(sin)^2*x(2))/((cos)^3*x(2)))-(b*(sin)*2*x(2))+(a*(cos)*x(2)))+ K*(x(1)-x(2));
end
1 个评论
Steven Lord
2023-6-21
Please don't open a new question for the same issue. Keep the discussion in the original question:
https://www.mathworks.com/matlabcentral/answers/1986394-kindly-help-me-out-with-this-code-its-urgent-please-thanks?s_tid=srchtitle
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!