Problems with proc syntax
Afficher commentaires plus anciens
Hello,
I'm new here and doesn't got the proc-Syntax from the docu(https://de.mathworks.com/help/symbolic/mupad_ug/procedures.html) running. I tried different syntaxes and removed the ':' after end_proc because it caused additional syntax-errors. I'm using matlab R2016b
The syntax error says 'Undefined function or variable 'calc_TCU''
TCU=zeros(1,10);
calc_TCU := proc(index,time,I)
begin
TCU_gain=TCU(index-1)+time/t_max2(I*10-9);
TCU_end=I*(1-0.8)/(1.15*7);
TCU(index)=(TCU_gain-TCU_end)*(2.71)^(-t/(87.4*3))+TCU_end;
end_proc
Réponse acceptée
Plus de réponses (1)
Aliou Thiam
le 26 Avr 2022
0 votes
percol_aiguilles := proc(p)
local i, j, x, y, n, angle, pts, lignes, longueur, liste_pts,
liste_lignestemp, liste_lignes, liste;
n := stats[random, poisson[p]](1);
for i to n do
x[i] := evalf(1/1000000000000*rand());
y[i] := evalf(1/1000000000000*rand());
pts[i] := disk([x[i], y[i]], 0.005, color = black);
angle := 1/1000000000000*Pi*rand();
lignes[i] := line([evalf(x[i] - 0.1*cos(angle)),
evalf(y[i] - 0.1*sin(angle))],
evalf(x[i] + 0.1*cos(angle)),
evalf(y[i] + 0.1*sin(angle))], color = black,
thickness = 1)
end do;
for i to n do liste_pts := [seq(pts[i], i = 1 .. n)] end do;
for i from 2 to n do for j to i do
longueur :=sqrt((x[i] - x[j])^2 + (y[i] - y[j])^2);
if longueur < 1/1000000000000*rand() then
lignes[i, j] := line([x[i], y[i]],
[x[j], y[j]], color = black, thickness = 2)
else lignes[i, j] := line([x[i], y[i]],
[x[j], y[j]], color = gray, thickness = 1)
end if end do end do;
plots[display]([seq(lignes[i], i = 1 .. n), op(liste_pts)],
view = [0 .. 1, 0 .. 1], axes = normal, scaling = constrained)
end proc
Catégories
En savoir plus sur Functional Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!