Function giving 2 outputs

Hi, everyone! I have a function wich has 2 inputs, each of them with another different function (f and g), thus I separetade it in 2 files, Secantef and Secanteg. The problem is Secanteg is giving me two different results, and it shouldn’t. Secantef is basically the same and it doesn’t… I’ll let the 4 files here, any help is appreciated!


f.m (46 Bytes)
g.m (57 Bytes)
Secantef.m (99 Bytes)
Secanteg.m (95 Bytes)

My system

  • OS: e.g. Windows 10 (version 2004) or Ubuntu 20.04
  • Octave version: e.g. Version 6.1.0
  • Installation method: e.g. Downloaded and installed “octave-6.1.0-w64-installer.exe” from Download

I haven’t peeked at the files yet, but check for a line with a missing semicolon at the end. You are probably only returning w once, but it’s just being echoed twice because of a missing semicolon

1 Like

Secanteg.m doesn’t define a return value. You want the declaration to be something like

function Y = Secanteg(N)
1 Like

Hi again! Now I’ve been receiving the following error: error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x50). The problem is on the line I define x, but isn’t x a 1x50 vector? If it’s not, why? Here’s a print of the code.
image

what value does N have on line 7?

3 Likes

Oh, now I see… N was supposed to be equals to 50, not 1:50. Thanks!

Hi again! Can you figure out what’s the sintax error in line 39, please? I would really appreciate that…

you have 4 of these (
and only 3 of these )

1 Like

Ok, now it says op1 is 1x50 and op2 is 1x49… Wich is each of them?


image

Read the help on whos!
help whos

Ok, my teacher made me remake almost everything saying it’all was nonsense… Now I defined X, x, i and other variables Secanteg and Secantef, but it says image
I don’t know why, it was very well defined inside the function, but ok. So I defined them all in the script, and octave gave me the same error message… I’d be glad if you could take a look!
image
Ex_3_IC_parte_1.m (202 Bytes)
f.m (46 Bytes)
g.m (58 Bytes)
Secantef.m (138 Bytes)
Secanteg.m (137 Bytes)