Duty cycle Matlab funciton is Simulink. Error! -Undefined function or variable 'duty_cycle'. The first assignment to a local variable determines its class.

조회 수: 4 (최근 30일)
Hi,
I want to make a function which would vary the duty cycler of a converter to get 400V output.
UNfortunately I am getting the error: Undefined function or variable 'duty_cycle'. The first assignment to a local variable determines its class.
This is my code. can you tell me what I should do?
function duty_cycle = dutycycle(Voltage_grid,past_duty)
duty_cycle_=0
if Voltage_grid>400
duty_cycle=duty_cycle-0.1
end
if Voltage_grid<400
duty_cycle=duty_cycle+0.1
end
if Voltage_grid==400
duty_cycle=past_duty
end
end

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 6월 1일
Two comments.
  1. Feed the "duty_cycle" to a "unit delay" block and then connect it to "past_duty".
  2. The first line inside your MATLAB Function should be "duty_cycle=past_duty;"
This way, you'll be able to regulate the voltage.
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2020년 6월 1일
Your feedback control logic seems right however there are many elements in the loop. You just need to debug along the loop to see if all the signals make sense. You might also need to increase the "Gain" for this simple PI controller.
Mario Nikolov
Mario Nikolov 2020년 6월 1일
Okay senpai. Thank you. Do capacitors and inductors change the voltage outputs, besides duty cycle?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Phase-Locked Loops에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by