saving . . . saved
Error in graphic plot
##### Question

function D = f(v) D = (1 ./k^2 .* g)(W .*(W-B).*log(1 + (k .*v)./(W - B)) - W .*k .*v); endfunction; B = 470; k = 0.08; g = 32; W = 527; disp("hi"); function[] = grafico(ini, fim) intervalo = fim-ini; // intervalo de a até b intervalo = intervalo / 100; // dividir o intervalo em 100 partes iguais while(ini < fim); v = ini; D = f(v); ini = ini + intervalo; // a cada iteração, o intervalo é somado ao valor ini plot(v, D, '.k'); end; endfunction; a = 0; //intervalo inicial b = 0.0001; //intervalo final ini = a; fim = b; grafico(a, b); I keep receiving an strange error. Can someone help me?

Scilab 03-05-16, 10:02 p.m. mipeli

The code has been modified to this-

B = 470; k = 0.08; g = 32; W = 527;
function D = f(v)
D = (1 ./k^2 .* g)*(W .*(W-B).*log(1 + (k .*v)./(W - B)) - W .*k .*v);
endfunction;

function[v,D] = grafico(ini, fim)
intervalo = fim-ini
intervalo = intervalo / 100
l=length(ini:intervalo:fim)
for i=1:1:l
v(i) = ini;
D(i)= f(v(i));
ini = ini + intervalo;
end;
plot(v,D)
endfunction;

a = 0; //intervalo inicial
b = 0.0001; //intervalo final
ini = a; fim = b;
[v,D]=grafico(a, b,'k');

This\r\n plots v vs D. I don't understand plot(v, D, '.k'); Are you trying to \r\nspecify the curved should be plotted in black? Then it is only 'k'. If \r\nnot, please let me know.

04-05-16, 10:45 a.m. shamika