prompt the user to enter a vector of coefficients for the polynomial model. verify that the entry has an even number of elements (an odd number of elements would mean an even order polynomial) in matlab

main.m
coefficients = input('Enter the vector of coefficients for the polynomial model: ');
if mod(numel(coefficients), 2) == 0
    disp('The number of coefficients entered is even.');
    disp('Valid for an odd degree polynomial.');
else
    disp('The number of coefficients entered is odd.');
    disp('This is not valid for an odd degree polynomial.');
end
353 chars
9 lines

related categories

gistlibby LogSnag