Anteprima
Vedrai una selezione di 3 pagine su 6
Disdici quando
vuoi
vuoi
Acquista con carta
o PayPal
o PayPal
Scarica i documenti
tutte le volte che vuoi
tutte le volte che vuoi
Estratto del documento
FUNCTION DI SPETTRO
function [X,f]=spettro(x,dt)
N=length(x);
X=fftshift(fft(x))*dt;
df=1/(N*dt);
if mod(N,2)==0
f=[-N/2+[0:N-1]]*df;
else
f=[-(N-1)/2+[0:N-1]]*df;
end
MAIN DI PENDOLO
% lancia second order
% parametri
B = 0.2;
g = 9.8;
% condizioni iniziali
dx0 = 1;
x0 = 1;
M = 1;
sim('secondorder');
figure(1)
subplot(2,2,1)
plot(tout, x, 'b')
title('posizione per M=1')
xlabel('Tempo [s]')
ylabel('x')
subplot(2,2,2)
plot(tout, dx, 'r')
title('velocità per M=1')
xlabel('Tempo [s]')
ylabel('dx')
M = 2;
sim('secondorder');
subplot(2,2,3)
plot(tout, x, 'b')
title('posizione per M=2')
xlabel('Tempo [s]')
ylabel('x')
subplot(2,2,4)
plot(tout, dx, 'r')
title('velocità per M=2')
xlabel('Tempo [s]')
ylabel('dx')
MAIN DI TRIANGOLARESUP
clear all
% U * x = b
% [4x4] [4x1] [4x1]
U = [132 -234 23 -960 97 -4 80 0 24 160 0 0 -11]
b = [12;
-588; 94; 0][x,d] = triangolaresup(U,b)U*x-FUNCTION DI TRIANGOLARESUPfunction [x,d] = triangolaresup(U,b)n = length(b);d = 1;for i = 1:nd = d * U(i,i);end è invertibile.')assert(d~=0,’La matrice U nonx = zeros(n,1);for i = n:-1:1S = 0;for j = (i+1):nS = S + U(i,j)*x(j);endx(i) = (b(i)-S)/U(i,i);endend-MAIN DI LAGRANGEclear allx = [10 50 70 230 460 503];y = [1 12 24 -36 59 -73];j = 3v = 80lv = lagrange(x,j,v)-FUNCTION DI LAGRANGEfunction lv = lagrange(x,j,v)n = length(x);%%%assert((j>=1)&&(j<=n),'j deve essere compreso tra 1 e n');%%%P = 1;for i = 1:nif i ~= jP = P * (v-x(i)) / (x(j)-x(i));endendlv = P;end-MAIN DI SUMMAXclear allA = rand(5,12)[s,m] = summax(A)-FUNCTION DI SUMMAXfunction [s,m] = summax(A)[l,n] = size(A);s = zeros(1,n);m = zeros(1,n);for j = 1:nfor i = 1:ls(j) = s(j) + A(i,j);if A(i,j) > m(j)m(j) = A(i,j);endendendend-MAIN DI ERROREclear allx = [1 2 3];y = [4 5 6];[ea,er] = errore(x,y,1)[ea,er] = errore(x,y,2)[ea,er] =
errore(x,y,3)[ea,er] = errore(x,y,4)
Dettagli
SSD
Scienze matematiche e informatiche
INF/01 Informatica
I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher Thomas_9 di informazioni apprese con la frequenza delle lezioni di Laboratorio di informatica e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Università degli Studi di Firenze o del prof Mucchi Lorenzo.