octave - 我如何使用我创建的第二个函数?
问题描述
当我想调用我在第 12 行创建的第二个函数时,它给了我一个错误(赋值右侧的值未定义)
function cosaprox
clc, clear
%d es el incremento y c sera la aproximacion del coseno
d = pi/100;
c = 0;
tol = 0.2;
i = 0;
flag = true;
%Aproximacion del cos
while flag
%Iteracion de la sumatoria
x=facto (2*i)
i+=1
if abs(c - cos(2*pi))>= tol
flag = false
else
endif
endwhile
disp (c)
end
function facto (x)
if x==0;
x=1;
endif
for h = 1:x-1
x = x*h;
endfor
end
解决方案
推荐阅读
- c# - C# TCP 服务器监听多个端口
- nested - 嵌套的 Hyper-V VM 无法从主机 ping 到 VM 中的 VM
- node.js - UnhandledPromiseRejectionWarning:错误:交易已被 EVM 还原
- python - Discord.py - 嗨命令需要修复
- javascript - 移动对象后工具提示不会消失
- c# - 在 C# 中,如何将接口转换为扩展接口的接口?
- price - 如何在分层导航中将价格显示为两个输入字段:“from”和“to”
- math - 找到平面的隐式表示
- config - 在 Snakefile 中访问 `--configfile` 的路径
- php - 致命错误:未捕获的错误:未找到“Cloudinary”类