scilab

Scilab 5.5.2 function as a block in xcos : Variable returned by scilab argument function is incorrect [

拜拜、爱过 提交于 2019-12-25 00:38:08
问题 I have been trying to get the ultrasonic data from an arduino using serial communication toolbox in scilab to be brought in the xcos simulation. To do this I followed Include a Scilab function/script as a block in xcos/scicos and created my own function. Is there a way to plot the serialread data in xcos scope? or i think my implementation is wrong in the scilab function. Iam Using Windows 10 64bit SCILAB function function y = serialREAD(a) h = openserial(7, "9600,n,8,1") // open COM7 for ii

Scilab: Parameters estimation on Lotka Volterra model Scilab

泪湿孤枕 提交于 2019-12-25 00:04:58
问题 I have tried to reproduce the script of the following link: Parameters estimation on Lotka Volterra model with Scilab And I get similar errors in the results to those described in it.. You could guide me to run the script without errors. Gracias Hermes 回答1: Solution for Scilab 5.5.1 or smaller The problem is that the solver somehow reach a point where it cannot solve the ode on every t and stops at a certain point. Thus your y_calc is smaller than y_exp in size. If this is not a problem for

Scilab: same colormap in contourf

对着背影说爱祢 提交于 2019-12-23 05:35:13
问题 When the following program is run, It becomes the same figure. I want the same color-coding. x=-5:0.1:5; y=-5:0.1:5; [X,Y]=meshgrid(x,y); z1=X.^2+Y.^2-25; z2=X.^2+Y.^2-50; clf(); f=gcf(); f.color_map=jetcolormap(32); subplot(1,2,1); contourf([],[],z1,32); subplot(1,2,2); contourf([],[],z2,32); 回答1: I don't know how to do it with contourf , but if you can use surf instead, I have a suggestion. Please note, that surf generates a 3D plot, but you can rotate it to seem as a 2D plot. And as a

How to make Scilab open a serial communication with /dev/ttyACM0 USB port in Linux (Ubuntu)

≯℡__Kan透↙ 提交于 2019-12-22 18:44:08
问题 I'm trying to open a serial communication between Scilab and Arduino. However, Arduino is always recognized by Linux Ubuntu in the /dev/tty**ACM0** port. When I write h=openserial(1,"9600,n,8,1) in Scilab I know that I'm saying to it, to open a serial comunication to COM1 or /dev/tty**S0** in Linux. But, for example, if I use h=openserial(N,"9600,n,8,1) , assuming N=port number , I will always have COMN, in Windows and /dev/tty**S**(N-1) in Linux. How do I open a serial comunication through

strange function definition in Scilab<->C interface

…衆ロ難τιáo~ 提交于 2019-12-20 05:46:11
问题 I'am talking about this example of a Scilab<->C wrapper: http://www.scilab.org/doc/intro/node89.html. The strange part is this one: int intsfoubare(fname) char *fname; { ....(some code) } It is some kind of function defintion but I really don't understand what the char *fname is good for also just fname as parameter makes no sense to me. Is someone able to explain this? [start crying] Scilabs documentation in general is a negative example but when it comes to the C-interface it's even worse.

Are there C like pre-processor directives for Octave and Scilab to be used for intercompatible code?

我的梦境 提交于 2019-12-20 04:07:55
问题 In C / C++ languages one can use macros or as called "per-processor directives" to instruct the compiler how the code should be read. The simple commands of #def , #ifdef , #ifndef , #else , #endif ... give the compiler the ability to check for Operating system, compiler and other environment information. I know Octave and Scilab are interpreted languages, but I'm wondering if is there any way to tell the interpreter to replaces parts of script while loading it? For example can I write a code

Why doesn't Python throw an error for this? [duplicate]

ぐ巨炮叔叔 提交于 2019-12-20 02:13:43
问题 This question already has answers here : Why does substring slicing with index out of range work? (3 answers) Closed 5 years ago . MATLAB throws an error for this: >> a = [2,3,4] >> a(3:4) index out of bounds If something similar is tried with Python, why isn't it illegal? >>> a = [2,3,4] >>> a[2:3] [4] Isn't the Index '3' in python out of bounds, considering Numbering starts from Zero in Python? 回答1: Slicing never raise error in python for out of bound indexes.. >>> s =[1,2,3] >>> s[-1000

Why doesn't Python throw an error for this? [duplicate]

有些话、适合烂在心里 提交于 2019-12-20 02:13:26
问题 This question already has answers here : Why does substring slicing with index out of range work? (3 answers) Closed 5 years ago . MATLAB throws an error for this: >> a = [2,3,4] >> a(3:4) index out of bounds If something similar is tried with Python, why isn't it illegal? >>> a = [2,3,4] >>> a[2:3] [4] Isn't the Index '3' in python out of bounds, considering Numbering starts from Zero in Python? 回答1: Slicing never raise error in python for out of bound indexes.. >>> s =[1,2,3] >>> s[-1000

What is the precision of floating point calculations in Scilab?

余生颓废 提交于 2019-12-19 11:36:17
问题 Note: I've used the Matlab tag just in case they maintain the same precision. (From what I can tell both programs are very similar.) As a follow-up to a previous question of mine (here), I'm trying to determine the level of precision I need to set (in a C++ program which I'm currently converting from Scilab code) in order mock the accuracy of the Scilab program. Essentially so both programs with produce the same (or very similar) results. When computing a floating point calculation in Scilab,

How to convert a boolean array to an int array

白昼怎懂夜的黑 提交于 2019-12-18 10:13:17
问题 I use Scilab, and want to convert an array of booleans into an array of integers: >>> x = np.array([4, 3, 2, 1]) >>> y = 2 >= x >>> y array([False, False, True, True], dtype=bool) In Scilab I can use: >>> bool2s(y) 0. 0. 1. 1. or even just multiply it by 1: >>> 1*y 0. 0. 1. 1. Is there a simple command for this in Python, or would I have to use a loop? 回答1: Numpy arrays have an astype method. Just do y.astype(int) . Note that it might not even be necessary to do this, depending on what you're