Write a user-defined MATLAB function that takes one single-valued input argument and checks whether the input argument is divisible by 3. If the input argument is divisible by 3, the function should return 1; otherwise, it returns 0.
1
Expert's answer
2011-07-01T19:02:54-0400
Create a file "is_div.m" with the following contents:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [res] = is_div(x) if (rem(x,3)==0) res=1; else res=0; end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Then you can test this function by using the following commands:
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment