% Power Quality Harmonic Interactive Demo
% This interactive demo generates power quality harmonic waveform up to
% 15th orders based on numerical modeling approach.
% This demo also visualize the harmonic in frequency domain and computes
% the its Total Harmonic Distortion.
% It allows user to set the magnitude and phase for each harmonic order.
% The harmonic waveform can then save as .mat file format.
function PQHarmonicDemoMain
figure('NumberTitle','off','Toolbar','none',...
'Name','Power Quality Harmonic Interactive Demo');
hTD = zeros(1,320);
h = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
hlast = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
ph = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
phlast = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
subplot(3,1,1);
subplot(3,1,2);
uicontrol('Style', 'text', 'String', '幅值 (pu)',...
'Position', [80 90 80 20],'horizontalAlignment', 'left');
uicontrol('Style', 'text', 'String', '相位 (deg)',...
'Position', [80 60 80 20],'horizontalAlignment', 'left');
uicontrol('Style', 'text', 'String', '谐波阶数',...
'Position', [80 30 80 20],'horizontalAlignment', 'left');
hMagTxt = uicontrol('Style','edit','string','1','Enable','inactive',...
'Position', [170 90 40 20],'BackgroundColor','w',...
'horizontalAlignment','left');
hMagSldr = uicontrol('Style','slider','Min',0,'Max',1 ,'Value',1,...
'SliderStep', [0.01, 0.1],...
'Position',[205 90 15 20],'Callback',@harmonic);
hPhTxt = uicontrol('Style','edit','string','0','Enable','inactive',...
'Position', [170 60 40 20],'BackgroundColor','w',...
'horizontalAlignment','left');
hPhSldr = uicontrol('Style','slider','Min',0,'Max',180 ,'Value',0,...
'SliderStep', [1/18, 0.1],...
'Position',[205 60 15 20],'Callback',@harmonic);
hOrder=uicontrol('Style', 'popup', 'String',1:16,...
'Position', [170 30 50 20],'Callback',@OrderSelect,...
'horizontalAlignment', 'left');
uicontrol('Style', 'text', 'String', '系统频率 (Hz)',...
'Position', [250 90 100 20],'horizontalAlignment', 'left');
uicontrol('Style', 'text', 'String', '采样频率 (Hz)',...
'Position', [250 60 100 20],'horizontalAlignment', 'left');
hFreqSelect=uicontrol('Style', 'popup', 'String',{'50','60'},'Value',1,...
'Position', [350 90 50 20],'Callback',@harmonic,...
'horizontalAlignment', 'left');
hFsTxt = uicontrol('Style','edit','string','1600','Enable','inactive',...
'Position', [350 60 50 20],'BackgroundColor','w',...
'horizontalAlignment','left');
hPreset=uicontrol('Style', 'popup', 'String',...
{'纯正弦波','1ph整流器谐波'},'Value',1,...
'Position', [250 20 150 30],'Callback',@Preset,...
'horizontalAlignment', 'left');
uicontrol('Style', 'pushbutton', 'String', '导出数据',...
'Position', [430 30 80 80],'Callback',@Export);
harmonic;
function Export(~,~)
uisave('hTD','harmonic');
end
function Preset(~,~)
switch get(hPreset,'Value')
case 1
h = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
hlast = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
ph = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
phlast = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
case 2
h = [1,0,0.8,0,0.6,0,0.4,0,0.2,0,0.1,0,0,0,0];
hlast = [1,0,0.8,0,0.6,0,0.4,0,0.2,0,0.1,0,0,0,0];
ph = [0,0,180,0,0,0,180,0,0,0,180,0,0,0,0];
phlast = [0,0,180,0,0,0,180,0,0,0,180,0,0,0,0];
end
OrderSelect;
harmonic;
end
function OrderSelect(~,~)
switch get(hOrder,'Value')
case 1
set(hMagSldr,'Value',hlast(1));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(1));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 2
set(hMagSldr,'Value',hlast(2));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(2));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 3
set(hMagSldr,'Value',hlast(3));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(3));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 4
set(hMagSldr,'Value',hlast(4));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(4));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 5
set(hMagSldr,'Value',hlast(5));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(5));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 6
set(hMagSldr,'Value',hlast(6));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(6));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 7
set(hMagSldr,'Value',hlast(7));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(7));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 8
set(hMagSldr,'Value',hlast(8));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(8));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 9
set(hMagSldr,'Value',hlast(9));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(9));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 10
set(hMagSldr,'Value',hlast(10));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(10));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 11
set(hMagSldr,'Value',hlast(11));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(11));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 12
set(hMagSldr,'Value',hlast(12));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(12));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 13
set(hMagSldr,'Value',hlast(13));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(13));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 14
set(hMagSldr,'Value',hlast(14));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(14));
set(hPhTxt,'String',get(hPhSldr,'Value'));
case 15
set(hMagSldr,'Value',hlast(15));
set(hMagTxt,'String',get(hMagSldr,'Value'));
set(hPhSldr,'Value',phlast(15));
set(hPhTxt,'String',get(hPhSldr,'Value'));
end
end
function harmonic(~,~)
if get(hFreqSelect,'Value')==1
f = 50;
fs = 1600;
t = 1/fs:1/fs:0.2;
set(hFsTxt,'String','1600');
else
f =
没有合适的资源?快使用搜索试试~ 我知道了~
电能仿真基于matlab电能质量谐波波形仿真【含Matlab源码 2263期】.zip
共2个文件
m:1个
jpg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 145 浏览量
2022-12-05
18:59:18
上传
评论 2
收藏 33KB ZIP 举报
温馨提示
CSDN海神之光上传的全部代码均可运行,亲测可用,尽我所能,为你服务; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,可私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、物理应用 仿真:导航、地震、电磁、电路、电能、机械、工业控制、水位控制、直流电机、平面电磁波、管道瞬变流 光学:光栅、杨氏双缝、单缝、多缝、圆孔、矩孔衍射、夫琅禾费、干涉、拉盖尔高斯、光束、光波、涡旋 定位问题:chan、taylor、RSSI、music、卡尔曼滤波UWB 气动学:弹道、气体扩散、龙格库弹道 运动学:倒立摆、泊车 天体学:卫星轨道、姿态
资源推荐
资源详情
资源评论
收起资源包目录
【电能仿真】基于matlab电能质量谐波波形仿真【含Matlab源码 2263期】.zip (2个子文件)
【电能仿真】基于matlab电能质量谐波波形仿真【含Matlab源码 2263期】
Main.m 14KB
运行结果.jpg 37KB
共 2 条
- 1
资源评论
- m0_710790292024-07-16资源内容总结的很到位,内容详实,很受用,学到了~
海神之光
- 粉丝: 5w+
- 资源: 6110
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功