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);B=1/(k*T);M1=1/(L-m); M2=1/(L+m);r1=1/sqrt(C*
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 00:16:07
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);B=1/(k*T);M1=1/(L-m); M2=1/(L+m);r1=1/sqrt(C*
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);
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;
A2=a2*cos(r2*t)+b2*r2*sin(r2*t)/M2;
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);
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');
怎么画出来都是离散的点呢?我想画出来是连续的曲线,该怎么修改?请高手指教!
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);B=1/(k*T);M1=1/(L-m); M2=1/(L+m);r1=1/sqrt(C*
因为你是在for循环中画的,所以循环一次算出一个点,matlab就画一个点.你可以在循环完毕后在使用plot画图:
clear all;
clc;
i=1; %脚标i
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);
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;
A2=a2*cos(r2*t)+b2*r2*sin(r2*t)/M2;
I1(i)=(m*(a*A2-b*A1)+L2*(c*A2-d*A1))/(m^2-L1*L2);
I2(i)=(m*(d*A1-c*A2)-L1*(a*A2-b*A1))/(m^2-L1*L2);
i=i+!;
end %循环结束
%作图
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');