Decrement of the value of varivel with Matlab Function
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am new user of MATLAB. I need to create a decrement function. Example:
EcAcum = Ec- (Ec- (EcAcum-Input);
At where,
EcAcum: Available kinetic energy;
Ec: Total kinetic energy;
Input: Field instantaneous energy;
My goal is to start the decrease from the EC value and decrease to zero.
I tried using Matlab Function but it did not work.
8 个评论
Greg
2018-5-18
编辑:Greg
2018-5-18
I don't understand the question. How can you possibly subtract a value from a variable that doesn't exist? You can't have a delta without an initial condition.
I think you want a loop, not a function. Re-reading that you're dealing with energy, I am guessing you are starting with some energy, and using it in bursts until you run out.
EcAcum = Ec; % The energy available in the system at the beginning
while EcAcum > 0
% Probably some code here to calculate "Input"
% which is assumedly the energy used by some action
EcAcum = EcAcum - Input; % The remaining available energy in the system?
end
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Additional Math and Discrete 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!