請教各位Matlab高手

小弟不才, 最近碰到兩題很棘手的問題, 請各位大大是否能以演算法方式幫我解答呢?? 題目如下... ISBN numbers (since 2007) for book identification are 13-digit integers which have a very special property to ensure that they are valid. This is called the “1-3-sum”, and is calculated by multiplying the first digit by 1, the 2nd digit by 3, the... show more 小弟不才, 最近碰到兩題很棘手的問題, 請各位大大是否能以演算法方式幫我解答呢?? 題目如下...

ISBN numbers (since 2007) for book identification are 13-digit integers which have a
very special property to ensure that they are valid. This is called the “1-3-sum”, and
is calculated by multiplying the first digit by 1, the 2nd digit by 3, the 3rd by 1, the 4th
by 3, etc, all the way to the last digit which is multiplied by 1. These values are then
added together to get the final 1-3-sum. If the ISBN number is valid, this sum will be
a multiple of 10. Write a MATLAB function which takes as input a single number
(the ISBN number) and then returns whether the number is a valid ISBN number or
not. To do this, you should use a local function (within your function) called
one_three_sum, which calculates the 1-3-sum of the number. Test the function by
using the ISBN of any books you may have (note that the BARCODE is usually the
correct 13-digit ISBN for older books)

--------------------------------------...

The factorial of a number is defined as n! = 1 for n = 0, otherwise n! = n * (n-1)!. For
example, 5! = 5x4x3x2x1 = 120. Write a MATLAB function which calculates the
factorial of a number and returns the result. Note that your function should first check
that the number is both an integer and non-negative, as negative factorials are not
defined. You can use the isnumeric() and isfloat() functions to check if a number is
an integer or not. Test your function to make sure it outputs the correct results (don’t
go too high, the numbers get very large!).
Update: 請用MATLAB裡面的 Editor~ 3q~~~
Update 2: 感謝這位大大的回答~非常非常非常感謝!!!
請問可以留下msn,進一步的解釋給我聽嘛~@@?拜託了!
1 answer 1