Matrix won't display while inside "if" statement
Show older comments
% This script uses the function, respower, to test several pre-computed % test cases of equivalent resistance and power rating, and it compares the % functional values with actual values.
A = [4 5 3];
B = [200 3 40];
Req = (1/((1/4)+(1/5)+(1/3)));
Peq = 34;
total = respower(A,B);
if (total ~= [Req,Peq])
fprintf('Test values used for resistors: %d ',A);
fprintf('\n')
fprintf('Test values used for power ratings: %d ',B);
fprintf('\n');
fprintf('The actual result for equivalent resistance (left) and equivalent power rating (right) is: %f',[Req,Peq]);
fprintf('\n');
fprintf('The expected result for equivalent resistance in ohms (left) and equivalent power rating in watts (right) is: %f',total);
fprintf('\n');
end
The respower function works correctly. This test is for when the pre-computed equivalent resistance and power rating (test values) does not agree with the function. For some reason, I get absolutely no output from this code. Any help would be greatly appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Specialized Power Systems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!