Docsity

In crisi con matlab?, Lecture notes of Computer Science

Partial preview of the text

Download In crisi con matlab? and more Lecture notes Computer Science in PDF only on Docsity!

ATTENZIONE LE FUNZIONI NON POSSONO ESSERE DEFINITE ALL'INTERNO DI UN LIVE SCRIPT. DEVONO ESSERE SALVATE COME LIVE FUNCTION PER ESSERE UTILIZZATE IN UN LIVE SCRIPT Scrivere uno script che determini il valore max e min presente in un vettore. input: numero elementi del vettore (N), elementi (V(i)) Input numero elementi N Min=V(1) n=input(‘numero elementi '); V=zeros(1,n); i=1; while (i <= n) fprintf(‘inserisci elemento %d ‘,i); \(i)=input(' '); iFi+1; end Vv minimo=V(1); i=2; while i <=n if V(i) < minimo