Matlab中如何画出连续的曲线?
来源:学生作业帮 编辑:大师作文网作业帮 分类:物理作业 时间:2024/11/12 18:15:37
Matlab中如何画出连续的曲线?
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;
for 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');
end
为什么画出来始终是离散的点?怎么才能将这些点连起来呢?
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;
for 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');
end
为什么画出来始终是离散的点?怎么才能将这些点连起来呢?
%试试看这个
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分。很感谢你!
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分。很感谢你!
如何在matlab中画出三维曲线方程的图.
Matlab中如何在画出来的图中加上曲线名称
请问如何在MATLAB中画出函数曲线上某点的坐标线,即红色虚线,多谢.
matlab 如何画出满足如下条件的曲线
Matlab中,这个曲线怎么画出来
Matlab中,log10(y)=-0.5*log10(x)+1.8 ,请问如何画出plot(x,y)的曲线
matlab已知一条曲线各点,如何画出最接近曲线的直线?
matlab中如何设置freqs函数画出来的波形的颜色?用freqs在一个figure中画三条曲线其中这三条曲线的颜色要
如何对matlab画出的曲线中的定点进行打标记(并进行标记)
matlab中如何画出矩形场景的figure?
在matlab中,如何画出一个信号的频谱图?
matlab中如何画出这两个函数的图形?