Enlarge markers on Octave rlocus - octave

Is it possible to make the markers (zeros and poles) from rlocus on Octave?
I've found the following answer, but the file that is supposed to be modified does not seem to be used anymore, or at least I wasn't able to find it with locate on Linux.
https://electronics.stackexchange.com/questions/372728/octave-rlocus-format-ploles-and-zero
This is the code I'm using to generate the plot.
pkg load control;
s = tf ('s');
GH = (s + 1)/(s*(s + 2))
rlocus (GH);
This is the plot generated by the code:
But the poles and zeros are almost invisible on the standard plot.
Thanks in advance for any responses.

From within octave, type
which rlocus
on the terminal.
This will tell you the location of the file in your current octave / control-package installation.
You can then proceed and edit the file as per the instructions of the previous post.

Related

PlotlyJS.jl "savehtml" not defined

I need to share an interactive plot made using the PlotlyJS package in Julia. According to the documentation of the package PlotlyJS.jl, I need to use the "savehtml" function and set "js" argument to ":embed" in order to view it offline (screenshot attached). However, I got an error "UndefVarError: savehtml not defined". Can anyone tell me what may cause this problem?
FYI, the "savefig" function can save the plot into an HTML but the HTML cannot be viewed on other machines.
It is also acceptable if there is another way to save an HTML plot that can be assessed from other machines. The interactive plot is generated by PlotlyJS.jl.
Thanks very much in advance.
This creates a standalone file that can be used on other machines.
However, those other machines need to have access to the internet:
p = PlotlyJS.Plot(sin.(1:0.1:10))
open("f.html","w") do f
PlotlyJS.PlotlyBase.to_html(f, p; include_plotlyjs="cdn", full_html=true)
end
I just checked that this is as far as you can do as of today (version v0.8.18) as there is a bug in the source code of PlotlyBase.

How can I get Octave GUI to load/read .m files correctly in editor and console?

I am taking a class on using Octave for machine learning algorithms, and as part of the assignments, they provide a series of .m files to build upon with our own code as well as to run for submission credit through the auto-grader. My problem is that the .m files load perfectly fine in a regular text editor program like Atom or Notepad, but in Octave, the files are best described as nonsense, and thus will not run in the console. If I open the files in a regular editor and copy/paste over the crazy into Octave, it seems to save it and reopen fine. But, I have close to 20 files for the first project alone, and this solution is untenable in the long run. I have a screenshot of how it's loading. Is there some setting I need to change? Uninstall/reinstall Octave? I'm new to Octave and the Octave GUI, and I'm striking out with Google for a solution. I am using version 6.2.0. Thank you for any help/advice!
screenshot of how octave is loading my .m files
Update: I responded to this in a comment below, but I tried loading it another way into Octave GUI and received the following error: ">> error: load: unable to determine file format of 'C:/Users/sophi/documents/octave/assignment_1/computeCost.m" This tracks for me because it makes sense why it would open the files in such a weird way. It's simply not sure what they are. However, I created my own simple functions from scratch to test, saved them as .m files, and was able to run them perfectly fine. I'm including one of the files below. Maybe there's a key in the formatting of the files offered by the class which is impacting Octave's ability to process it correctly?
function plotData(x, y)
%PLOTDATA Plots the data points x and y into a new figure
% PLOTDATA(x,y) plots the data points and gives the figure axes labels of
% population and profit.
figure; % open a new figure window
% ====================== YOUR CODE HERE ======================
% Instructions: .... goes on about assignment
% ============================================================
end
MOST RECENT UPDATE: The plot thickens. Yesterday, I was able to open the files I created and run them in the Octave environment, and I (wrongly) assumed they would still work today. They are doing the same stupid thing as the files included by the course. I checked inside preferences for the editor, and it says it is loading and saving them as IBM273 if that helps. Thank you for everyone has pitched in ideas. I really appreciate it!
It was 100% the encoding. I thought it was strange it was saving/loading in IBM273, so I switched it to UTF-8. Almost all the files are working now. The only ones that aren't are the ones I was trying to copy/paste yesterday to see what was going on with the load problems and the basic new problems I wrote. So I deleted everything, redownloaded, and set the default UTF-8 going forward and voila! Solved! Thanks again!
If you want to open a .m file in octave, Try this solution
It is necessary to declare a current directory before saving a file, loading a file, or running an M-file. By default, unless you edit the Octave shortcut, the current directory will be .../Octave/work. After you start Octave, change the current directory by either using the toolbar at the left-hand side of the screen, or entering the path in the bar at the top.
To open an .m file, you can use file -> open, or type
open filename

Is there a way to introduce a delay in a system analyzed with the octave control package

I'm trying to analyze the system
20*e(0.9*s)
-------------
(s+10)
using GNU octave and the control package, but I cannot find the way to introduce the exponential (the exp octave function does not work).
The code I tried to write is
pkg load control
s = tf('s')
g = 20*exp(0.9*s)/(s+10)
but the following error is shown: error: exp: not defined for class
I tried searching the web a bit, without success.
Thanks in advance

How to output a .pvd or xdmf file from FiPy

From the example documentation, there is the following section:
FiPy doesn’t plot or output anything unless you tell it to:
if __name__ == "__main__":
viewer = Viewer(vars=(phi,), datamin=0., datamax=1.)
I understand that the current configuration would result in an opening of a viewer using the matplotlib or Mayavi viewers. However, I would like to be able to export a .pvd or .xdmf file for consolidating the simulation.
Thanks for your help!
FiPy presently has no such capability, although I've experimented a bit with XDMF and multi-timestep Gmsh MSH files, but need to find time to get back to it. You can save individual data snapshots with the VTKViewer classes, but not time series.
vw = fp.VTKCellViewer(vars=(phi, psi))
vw.plot(filename="myFile.vtk")
If there are particular thinks you'd like to see, please update issue #132.

Unable to save the plots in Octave using print and saveas command

I am using Octave 3.6.4 on Window 7, I am not able to save the 9 plots which are generated using Octave scripts. I am using below commands to save the plots. Though sometime I am able to save the plots but all the saved plots are same which is similar to the last plot generated by the script. Why?
pathfig = [path, '.png'];
print(h, '-dpng', pathfig,'-r100');
saveas(h, pathfig, 'jpg');
Since you are only seemingly saving the last plot you generate, it is safe to say that your variable h is assigned to that last plot.
You will likely need to specify each figure you want to print. For example, to get a handle to the first figure, you could do:
h1 = figure(1);
To get a handle to the second figure:
h2 = figure(2);
And separately use h1, h2, etc. in separate calls to saveas or print. This is how I have done it in the past.
I am able to save the specific figures. The problem is, I was using graphics_toolkit as fltk when I switch to gnuplot then the print command is working properly, but there is issue with saveas command.