Matlab中如何画出连续的曲线?
发布网友
发布时间:2023-03-18 11:05
我来回答
共3个回答
热心网友
时间:2023-11-09 07:07
%试试看这个
clear all;
clc;
L1=1; L2=1; L=1; C1=1; C2=1; C=1; m=0.5; w=50;
a=sqrt(2)/2; b=sqrt(2)/2; d=sqrt(2)/2; c=-sqrt(2)/2;
k=1.381*10^(-23); h=6.63*10^(-34);
T=273;
B=1/(k*T);
M1=1/(L-m); M2=1/(L+m);
r1=1/sqrt(C*(L-m)); r2=1/sqrt(C*(L+m));
a1=0; b1=0;
t=0:0.1:10;
a2=-sqrt(2)*(cos((w+r2)*t)/(2*(w+r2))+cos((w-r2)*t)/(2*(w-r2))-1/(2*(w+r2))-1/(2*(w-r2)));
b2=-(sqrt(2)*M2/r2)*(sin((w+r2)*t)/(2*(w+r2))-sin((w-r2)*t)/(2*(w-r2)));
A1=a1*cos(r1*t)+b1*r1*sin(r1*t)/M1;
B1=b1*cos(r1*t)-a1*M1*sin(r1*t)/r1;
A2=a2.*cos(r2*t)+b2*r2.*sin(r2*t)/M2;
B2=b2.*cos(r2*t)-a2*M2.*sin(r2*t)/r2;
q1=a*B1+b*B2; q2=c*B1+d*B2;
I1=(m*(a*A2-b*A1)+L2*(c*A2-d*A1))/(m^2-L1*L2);
I2=(m*(d*A1-c*A2)-L1*(a*A2-b*A1))/(m^2-L1*L2);
k1=(a^2)*h*M1/(2*r1*tanh(h*r1*B/2))+(b^2)*h*M2/(2*r2*tanh(h*r2*B/2))+2*a*b.*B1.*B2;
k2=(c^2)*h*M1/(2*r1*tanh(h*r1*B/2))+(d^2)*h*M2/(2*r2*tanh(h*r2*B/2))+2*c*d.*B1.*B2;
s1=k1-(q1).^2;
s2=k2-(q2).^2;
subplot(2,1,1);plot(t,I1);hold on; grid on; title('温度为273K时电流I1的热力学平均值随时间t变化的曲线');xlabel('t/时间');ylabel('I1');
subplot(2,1,2);plot(t,I2);hold on; grid on; title('温度为273K时电流I2的热力学平均值随时间t变化的曲线');xlabel('t/时间');ylabel('I2');追问非常感谢你,非常感谢,看了你的修改,我终于知道问题在哪里了。我再追加20分。很感谢你!
热心网友
时间:2023-11-09 07:07
plot本身就可以画连续的曲线追问但是这里却画不出,是离散的点。
热心网友
时间:2023-11-09 07:08
plot(t,I1,'*')改成plot(t,l1)