scilab

replicate Arduino's serial monitor on Scilab consol

蹲街弑〆低调 提交于 2019-12-18 07:23:41
问题 If I use the Arduino IDE's Serial monitor I can read the pair of comma separated values as below: I want to first replicate this behavior in SciLab terminal. I used the Serial Communication Toolbox: h = openserial(7, "9600,n,8,1") // open COM7 disp(readserial(h)) closeserial(h) which returns either empty or , 169 228, 179 228, 228, 205 228, 209 228, putting the disp(readserial(h)) in a while loop also doesn't help. Not only there are too many empty lines, if I stop the while loop it does not

How to use parallel 'for' loop in Octave or Scilab?

我只是一个虾纸丫 提交于 2019-12-18 05:56:01
问题 I have two for loops running in my Matlab code. The inner loop is parallelized using Matlabpool in 12 processors (which is maximum Matlab allows in a single machine). I dont have Distributed computing license. Please help me how to do it using Octave or Scilab. I just want to parallelize 'for' loop ONLY. There are some broken links given while I searched for it in google. 回答1: parfor is not really implemented in octave yet. The keyword is accepted, but is a mere synonym of for (http://octave

Parameters estimation on Lotka Volterra model with Scilab

风格不统一 提交于 2019-12-13 04:40:53
问题 I'm trying to make a parameters estimation on Lotka-Volterra model with Scilab (I am a total neophyte). When I try to run the script, Scilab warns about incoherent subtraction. I guess my problem is the same as in this topic, but the solution there uses a Matlab function. Here is my script: // 1. Create Lotka Volterra function function [dY]=LotkaVolterra(t,X,c,n,m,e) IngestC = c * X(1) * X(2) GrowthP = n * X(1) MortC = m * X(2) dY(1) = GrowthP - IngestC dY(2) = IngestC * e - MortC endfunction

Creating Animation in Scilab

半世苍凉 提交于 2019-12-12 08:19:01
问题 I am able to plot a point using the x and y coordinates using the following code. figure(1); plot(x(1),y(1),'o'); h_compound = gce(); h_compound.children.mark_size = 20; h_compound.children.mark_background = 2; h_axes = gca(); h_axes.data_bounds = [0,0;100,100]; My program contains a loop which keeps on refreshing the coordinate values. Every time the loop is executed the point is plotted in the same graphic, such that the new points overlap the older ones. How do I make the old points

Using scilab to solve and plot differential equations

我只是一个虾纸丫 提交于 2019-12-12 04:56:20
问题 How can I solve the second order differential equation using scilab ode() function. (For example: y'' + 3y' +2y = f(x), y(0)=0, y'(0)=0) And then plot the result of function y(x). I want to use this to model the RLC-circuit signal with step-function input Here is the code I tried function y=u(t) y=(sign(t)+1)/2 endfunction L=0.001 R=10 C=0.000001 function zdot=f(t,y) zdot(1)= y(2); zdot(2)=(u(t)-y(1)-L*y(2)/R)/(L*C); endfunction y0=[0,0]; t0=0; t=0:0.00001:0.001; out=ode(y0,t0,t,f); clf();

scilab - Writing multiple images to a single folder

五迷三道 提交于 2019-12-12 02:45:37
问题 I am working in Scilab 5.5.2 . I need to write multiple images to a single folder. The images which I want to write are cropped images from a set of inputs. I am able to write a single image to the folder with the following command: imwrite(fname,strcat('C:\Users\dell\Desktop\example_sci\myfolder\1.jpg')); I have put this in a for loop, so the output image is over written and the result is a single image. How can i write all the results to a single folder? 回答1: You should create the paths

illustrate a special function using scilab

倖福魔咒の 提交于 2019-12-11 18:31:06
问题 I have written a function to find Log(Fn) / n , where Fn is the sequence of Fibonacci numbers F_{n+1} = F_n + F_{n-1} : function [g] = logf(n) u = 0; v = 1; f = v; for i = 2:n do f = u + v; u = v; v = f; end g = log(f) / n; endfunction What I need is to plot this function for 1< n < 200 . 回答1: First all please try to learn MarkDown language to post readable questions. Your first question had some information which was not shown due to the conflicts with StackOverflow's MarkDown rendering.

SciLab: RGB color plot, trying to color each mark with its respective color

跟風遠走 提交于 2019-12-11 18:08:09
问题 All, I have made a 3d plot of some colors in the RGB color space. Currently the marks are all the same color. I would like each mark to be the color it represents in the space. So, a mark in the red corner of the plot should be red, etc... The code I have so far is below. Thanks for your help, -Bill // RGB color data for a few shades of pink and red r = [1, 1, 1, 1, 0.8588235294117647, 0.7803921568627451, 1, 0.9803921568627451, 0.9137254901960784, 0.9411764705882353]'; g = [0.7529411764705882

Scilab: How to solve an ODE where dy/dt = filter(1, ar, y1)

和自甴很熟 提交于 2019-12-11 17:03:13
问题 I want to simulate a time series y1 with an AR(p) process, and then solve the differential equation dy/dt = AR(p)(y1) . This is the Scilab code I wrote (the AR coefficients are calculated with the lev() function and then normalized in a part of the code I omitted to keep it short). t = [0:0.1:2*%pi]; y1 = sin(t); C = 1; y2 = -1*cos(t) + C; ar = [1. - 0.0195380 - 0.0154317 - 0.0116690 - 0.0081661 -0.1015448] y1_m = filter(1, ar, y1); //Generates simulated series function y_m = far(t, y, ar, y1

How to use the current date as name for a CSV file

限于喜欢 提交于 2019-12-11 10:19:34
问题 How do I create a csv file with date as the name of the csv file. I tried doing it, but the date won't appear only the name does. The language is Scilab which is similar to Matlab. 回答1: I do not understand your question fully. But following the csvWrite documentation and the date documentation. You could do someting like this filename_with_date_string = date() + ".csv"; directory_path = TMPDIR; // Some matrix you want to save M = [1:10] * 0.1; // Create the file file = fullfile(directory_path