verify if a result is reduced by 20% compared to a previous result in matlab

You can use the following formula to verify if a result currentResult is reduced by 20% compared to a previous result previousResult:

main.m
if currentResult == previousResult * 0.8
    disp('The result is reduced by 20%');
else
    disp('The result is NOT reduced by 20%');
end
138 chars
6 lines

This formula checks if currentResult is equal to previousResult multiplied by 0.8 (which is 20% reduction of previousResult). If it is, then it outputs "The result is reduced by 20%". Otherwise, it outputs "The result is NOT reduced by 20%".

related categories

gistlibby LogSnag