2

i'm doing a program in octave in which i got

t=0:.0002:20;

Gs=tf(100,[1 10])

u1=sin(t);

y1=lsim(Gs,u1,t);

plot(t,9.95*sin(t-0.1),’r’,t,y1,’b’)

However when i write Gs=tf(100,[1 10]) in the command window it appears "warning: the 'tf' function belongs to the control package from Octave Forge which you have installed but not loaded. To load the package, run 'pkg load control' from the Octave prompt." How can i load this package? I trully can't understand it... enter image description here

enter image description here

When i load it it appears:

pkg load control warning: addpath: C:\Octave\OCTAVE~1.0\mingw64\share\octave\packages\control-3.2.0: No such file or d irectory warning: called from load_packages_and_dependencies at line 48 column 5 load_packages at line 47 column 3 pkg at line 461 column 7

t=0:.0002:20; Gs=tf(100,[1 10]) error: could not find any INDEX file in directory C:\Octave\OCTAVE~1.0\mingw64\share\octave\packages
control-3.2.0, try 'pkg rebuild all' to generate missing INDEX files error: called from describe>parse_pkg_idx at line 94 column 5 describe at line 59 column 40 pkg at line 555 column 43 unimplemented>check_package at line 540 column 15 unimplemented at line 127 column 11

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • 2
    Please don't make more work for other people by vandalizing your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](//creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed. Thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](//meta.stackexchange.com/q/5221) – Machavity Jan 14 '21 at 21:36

1 Answers1

3

In the octave terminal, type

pkg load control

To load the control package. If you do not already have the control package installed, you need to install it. You can do so directly from Octave Forge by typing

pkg install -forge control

Note that this will install this package in your predefined 'prefix'. You can find where that is by typing

pkg prefix

If you're not sure if you have the control package installed, you can check the list of already installed packages by typing

pkg list

Type help pkg to see more details about how octave's package manager works.


In any case, the tf function belongs to the control package, and like all packages, you need to load it before you can use its functions.

Having said this, even after loading the control package, your above code doesn't work. It seems like you're calling the tf function using the wrong format.

Tasos Papastylianou
  • 21,371
  • 2
  • 28
  • 57
  • 1
    To add, if running Windows depending on how octave was installed, the package may already be preinstalled but a `pkg rebuild` command may be needed to have it appear in the pkg list. – Nick J Dec 03 '20 at 12:48
  • 1
    @NickJ in theory this should have been addressed and no longer necessary in v6.1.0 [(#51632)](https://savannah.gnu.org/bugs/index.php?51632), but good to point it out! :) – Tasos Papastylianou Dec 03 '20 at 13:08
  • @TasosPapastylianou it appears an error when i do it –  Dec 03 '20 at 13:23
  • @student if you mean the image you posted in the updated question, those are not errors, those are just warnings. If there were no errors below the part shown in the image, then presumably the package has installed correctly. Does it show when you do `pkg list`? Does it complain when you try to load it? – Tasos Papastylianou Dec 03 '20 at 13:45
  • i posted the picture above –  Dec 03 '20 at 14:37
  • @student `control` is the 3rd on that list, so it has been installed. Have you tried loading it? – Tasos Papastylianou Dec 03 '20 at 15:12
  • it appears this the message above (of the question i asked) –  Dec 03 '20 at 16:27
  • @student It looks like something weird is going on with the directory where it has been installed. Have you tried doing `pkg rebuild all` as the error message suggests? Alternatively, perhaps you could try installing the newer version of octave? Octave 6.1.0 has just been released which has addressed many issues related to packages on windows. – Tasos Papastylianou Dec 03 '20 at 17:40
  • if i write pkg rebuild all, it doens't happen nothing. If i install the new version of octave, i don't need to worry about the packages? –  Dec 03 '20 at 20:26
  • @student I think so -- unless it's a more general problem with your computer specifically – Tasos Papastylianou Dec 04 '20 at 00:09
  • @TasosPapastylianou i install the new version and it still doesnt work... –  Dec 04 '20 at 10:44
  • sorry to hear that. Perhaps you can write straight to the octave mailing list? – Tasos Papastylianou Dec 04 '20 at 10:58
  • what is the octave mailing list? –  Dec 04 '20 at 13:43
  • see here: https://www.gnu.org/software/octave/support – Tasos Papastylianou Dec 04 '20 at 13:58