阅读提示:为防止内容获取不全,请勿使用浏览器阅读模式。
(1);
subplot(1,2,1);
surf(x,y,B);
shadinginterp;
vie(2);%设置为二维视图以便类似plor的展示效果
axis([0Lx0Lymin(B(:))max(B(:))]);
title("磁场分布");
subplot(1,2,2);
scatter(x_particles,y_particles,"filled");
axis([0Lx0Ly]);
title("等离子体粒子位置");
%获取当前图形作为动画帧
frame=tframe(1);
frames{step}=frame;
%暂停一下以便观察(可根据需要调整或去掉)
pause(0.01);
end
%生成动画
video=Videoriter("pSma_magic_drift.avi");
video.FrameRate=10;
open(video);
forstep=1:num_steps
riteVideo(video,frames{step});
end
close(video);
”
毅吉吉说:“你这***程序也运行不出来啊。你这particles函数都调用错了。”
叶学德说:“那你有什么节目,***毅吉吉?”
“我来展示一个PM脉冲宽度调制,占空比不断循环,让小灯忽暗忽亮的程序。
#include"stm32f10x.h"Deviceheader
#include"dey.h"
intmain(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
GPIO_InitTypeDefGPIO_Initstructure;
GPIO_Initstructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Initstructure.GPIO_Pin=GPIO_Pin_All;
GPIO_Initstructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_Initstructure);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
GPIO_InitTypeDefGPIO_RRR;
GPIO_RRR.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_RRR.GPIO_Pin=GPIO_Pin_All;
GPIO_RRR.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOB,&GPIO_RRR);
GPIO_riteBit(GPIOA,GPIO_Pin_0,Bit_RESET);
hile(1)
{
GPIO_SetBits(GPIOB,GPIO_Pin_12);
GPIO_rite(GPIOA,
本章未完,请点击下一页继续阅读》》