clear all; close all; clc; % TANQUE DE AGUA CON ALTURA VARIABLE % Modelo no lineal para el tanque: % dh/dt = v/A - b/A*sqrt(h) % linalización: % dh'/dt = b/(2*A*raiz(hs))*h' + v'/A % donde las ' son las variables desviación A = 1; %ft2 hs = 5; %ft b = 1/sqrt(5); % ft2.5/min v = 1; % vin = vs = 1 ft3/min % visualización de la linealización graficando la derivada x = 0:.2:10; f = v/A - b/A*sqrt(x); fl = -b/(2*A*sqrt(hs))*(x - hs); plot(x',[f' fl']) xlabel('x') ylabel('f(x)') legend('no lineal','lineal') pause function y = dhdt(x,t,A,b,v) y = v/A - b/A*sqrt(x); endfunction t = 0:50; x0 = 10; %ft xnl = lsode(@(x,t) dhdt(x,t,A,b,v),x0,t); % función linealizada xl = hs + (x0 - hs)*exp(-t/(2*A*sqrt(hs))); plot(t',[xnl xl']) t = 0:50; x0 = 4; %ft xnl = lsode(@(x,t) dhdt(x,t,A,b,v),x0,t); % función linealizada xl = hs + (x0 - hs)*exp(-t/(2*A*sqrt(hs))); hold on ; % mantiene la curva graficada anteriormente plot(t',[xnl xl']) xlabel('t') ylabel('h (ft)') legend('no lineal 1','lineal 1','no lineal 2','lineal 2')