Function and global variable

How to write these function and calling function?
Write a function, f_lab10, that will calculate this series approximation. Run your series code until the approximate percent relative error (apre) is below a specified error se = 0.01. Write a main or calling program, fcall_lab10, that will call f_lab10. You can hard-code se and x in fcall_lab10. Document f_lab10 and fcall_lab10 fully. In this lab, we want to compute the series approximation for each value in a vector x = [0:0.04:0.8]; so, in fcall_lab10 you will need a loop that will call f_lab10 once for each value in x. Store the approximation for each value of x in the vector sapprox that you will size before starting you loop, for example, sapprox = zeros(size(x)); Pass the value of x to f_lab10 as an input, pass se to f_lab10 using the Global Memory, and pass the series approximation from f_lab10 to fcall_lab10 as an output of f_lab10. An example of the first two lines of your function is as follows:
function series_approx=f_lab10(x)
global se
Thanks!!

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by