13.07.2015 Views

CAPÍTULO 1 - Universidad de Sevilla

CAPÍTULO 1 - Universidad de Sevilla

CAPÍTULO 1 - Universidad de Sevilla

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Departamento <strong>de</strong> Física Aplicada III. <strong>Universidad</strong> <strong>de</strong> <strong>Sevilla</strong>disp (' ')disp (' ')disp ('disp (' ')disp ('disp ('disp ('disp ('ELIJA EL PERFIL DE CURVA DESEADA: ')1) POLÍGONO ')2) POLINOMIO GRADO N QUE PASE POR TODOS LOS PUNTOS ')3) INTERPOLACIÓN POLINOMIAL ')4) INTERPOLACIÓN SPLINE ')disp (' ');opcion=input('OPCIÓN = ');format long; %MAXIMA PRECISION PARA RESOLVER EL SSIT. ECS.switch (opcion)case 1 %POLIGONOSif (tiempos(length(tiempos)) ~= duracion) %ULTIMO PUNTO DISTINTO ADURACION%CALCULAMOS LA PENDIENTE DEL ÚLTIMO TRAMO DE RECTApendiente=(temps(length(temps))-temps(length(temps)-1))/(tiempos(length(tiempos))-tiempos(length(tiempos)-1));%CALCULAMOS EL VALOR DE LA TEMPERAURA FINAL POR INTERPOLACION DELULTIMO TRAMO DE RECTATfinal=pendiente * (duracion-tiempos(length(tiempos))) +temps(length(temps));%AÑADIMOS EL PUNTO FINAL DE LA CURVAtiemposlong=[tiempos, duracion];temps=[temps,Tfinal];clear Tfinal;endif (tiempos(1) ~= 0) %PRIMER PUNTO DISTINTO DE CERO%CALCULAMOS LA PENDIENTE DEL PRIMER TRAMO DE RECTApendiente=(temps(1)-temps(2))/(tiempos(1)-tiempos(2));Tinicial=pendiente * (0-tiempos(1)) + temps(1);tiemposlong=[0,tiemposlong];temps=[Tinicial,temps];clear Tinicial;end%INTERPOLAMOST=interp1(tiemposlong,temps,t);plot(t,T);clear tiemposlong;clear pendiente;case 2 %POLINOMIO GRADO N%SE PLANTEA COMO UN SISTEMA DE ECUACIONES EN EL QUE LAS INCOGNITAS%SON LOS N COEFICIENTES DEL POLINOMIO Y LOS DATOS LOS PUNTOSINTRODUCIDOSY=temps'; %PARA RESOLVER EL SIST TRABAJAMOS CON VECTOR COLUMNAx=[];for (i=1:1:length(Y)-1) % SUBMATRIZ NECESARIA PARA RESOLVER ELSISTEMAx=[x;tiempos.^i];end138

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!