You can find a pseudo implementation on Wikipedia: # Input: d[i,j], the number of voters who prefer candidate i to candidate j. # Output: p[i,j], the strength of the strongest path from candidate i to candidate j. for i from 1 to C for j from 1 to C if...

The semicolons make it one big column matrix, you should use comma's. In the illustration I below you can see the concept, kind of.... | | |[timetimestwo(1)],[rate(1)],[cumulative(1)]| | | |[timetimestwo(2)],[rate(2)],[cumulative(2)]| |[timetimestwo],[rate],[cumulative] | = |[timetimestwo(3)],[rate(3)],[cumulative(3)]| | | |[timetimestwo(4)],[rate(4)],[cumulative(4)]| | | |[timetimestwo(5)],[rate(5)],[cumulative(5)]| A working example of your problem would thus be: //import...

The parameters Aeq and beq represent linear equality constraints. Each row of Aeq has the coefficients of an equation, and the corresponding row of beq is the right hand side. Therefore, the number of rows in Aeq and beq must be the same. Also, the number of rows of c...

algorithm,runtime-error,sudoku,backtracking,scilab

The main issue is this line: solve(board) which should be S = solve(board) A recursive function must provide two things: a way to delegate a modified task to another instance of itself, and a way to return the result to the instance that called it. You didn't have the second...

Here an old SciLab implementation to get you started. I would advice in saving the resulting spectrograms as data, not as image. And write another function which can convert the data to images. // For simple plotting, Positions in Milliseconds!! function plotASpectrogram( source, startPosition, endPosition ) [audio,sampleRate] = wavread(source); startPosition...

Unlike in Matlab, invoking (t>=0) gives you a boolean vector, its entries are True or False. Since you want 1s and 0s, you need bool2s to convert from boolean to integers: deff('[u]=f(t)','u=bool2s(t>=0)') After that you can invoke the function like any other: t = 0:0.001:1 y = u(t-0.2)-u(t-0.3) plot(t,y) Personally,...

You forgot the return value n = in the very first line just after function, it will never return anything otherwise function n = fac(n) if (n<=0) then n = 1 else n = n* fac(n-1) end endfunction ...

Without checking the true meaning of your function, there are 2 syntax errors, which causes the problems: 1. indexing a matrix must be done in the form of erg(i,j) not erg(i)(j). But in your case since erg is a vector (one row matrix), you can omit the row index, and...

Scilab doesn't have a direct analogue of Python's fcn(*v) function call that would interpret the entries of v as multiple arguments. If you want to be able to call your function as either fcn(1,2,3,4,5,6) or as v = 1:6; fcn(v), then you'll need to add this clause to its beginning:...

The problem arises from the difference between the image coordinate system (used by imcrop and all the other functions of the SIVP toolbox) and the "regular" coordinate system (used by rubberbox, xcick and all the builtin functions). Images have the first pixel at top-left. On the contrary rubberbox have the...

1.) Whether to reverse the y coordinte or not, depends on the further processing. Any coordinate system can be used if you need only relative measurements and the true orientation of your features is not important (e.g. reversing top and bottom makes no difference if you simply want to count...

Maybe you're looking for dot product .* (or perhaps more appropriately "dot star")? http://www.math.fsu.edu/~bellenot/class/f07/em2/scilab/scilab-dot

Because time is a column vector and use that for the creation of timetimestwo, this will also be a column vector. In your csvWrite call you transpose the matrix with ', see quote character documentation. So simply removing ' character, will result in a non-transposed and thus column vector in...

I don't know either how to change directly the size of the legend: it seems to me, that it is always automatically calculated based on the length of the text. But there is a solution to get equally sized plots: you can set the size of the plot by the...

As far as I can tell you need to specify that variables are global explicitly in scilab; global counter counter = 0 function checkForA() global counter // Do some stuff counter = counter + 1 endfunction function checkForB() global counter // Do some stuff counter = counter + 3 endfunction...

It does not work, because if t is a vector (has more than one element), e.g. t=[-1 0 1] then t==0 yields a vector result: [F T F]. Thus you always got the else solution: y=1. To make it work, you can: 1.) use a for loop and check every...

Do you want to map the values this way?: clear clc minX = 24.27; maxX = 29.77; minY = 0.09; maxY = 1.1; x = linspace(minX,maxX,100); y = linspace(minY,maxY,100); % from x to y x_ = 24.27; y_ = (x_-minX) / (maxX-minX) *(maxY-minY) +minY; y_ = 0.09...

You could use a colormap to set the foreground color using an index. See also the other polyline_properties you can control. [rows, cols] = size(RejectedEv_t); for colNumber = 1:cols plot(RejectedEv_t(colNumber, :), RejectedEv_L2Latency(colNumber, :)) last_line = gce() last_line.children.foreground = colNumber end ...

algorithm,runtime-error,sudoku,backtracking,scilab

Well, one of the easiest way to program a Sudoku solver (not the most efficient) could be to solve each cell with all the possible options recursively (which could be similar to the "Backtracking" algorithm) until a full answer is found. Another options (I would say it's better) is to...

algorithm,graph-algorithm,matching,scilab

I do not know Scilab I am afraid, but if you are willing to use Python it is very easy as the Networkx library provides support for this function: import networkx as nx import networkx.algorithms.matching as matching def C(i,j): return i*j n=40 G=nx.Graph() for i in range(n): for j in...

Similarly to Matlab, you can format the output string by including the real and imaginary parts separately. mprintf('%g + %gi\n', real(a) , imag(a)) However, that looks pretty ugly when the imaginary part is negative. I suggest writing a formatting function: function s = complexstring(a) if imag(a)>=0 then s = sprintf('%g+%gi',...

The clear command is used to remove entire variables, see the documentation. If you could clear the 3,3 field it would result in a malformed matrix: 1. 4. 5. 9. 13. 11. 46. 29. I don't know of a way this is possible. What is it that you want? Do...

probability,scilab,cumulative-sum

The sum of all the probabilities of PMF is not 1 You could not possibly add all the probabilities, because the geometric distribution assigns nonzero probabilities to all positive integers. If you run the sum up to n=10, the sum of probabilities is appreciably less than 1. If you...

Typing help cputime in the Scilab console will reveal that this is not a Scilab function. The near-equivalent Scilab function is timer(), but its behavior is a bit different: cputime in Matlab measures time since Matlab started timer() measures time since the last call to timer() Here is your function...

Welcome to the world of programming/SciLab. There are great tutorials such as these which can help you to get started. Find a list of others on the SciLab wiki. To get to your question let's go through each function 1-by-1. fun1 This function needs to ask the user for two...