PROBLEM USING PLOT AND SUBPLOT WITH HANDLE FUNCTION

조회 수: 2 (최근 30일)
Bella Aylín López Julca
Bella Aylín López Julca 2020년 8월 11일
답변: Star Strider 2020년 8월 11일
Error using /
Arguments must be numeric, char, or logical.
Error in IZIMAT (line 47)
P=@(q) (L*V)/q
%Definiendo las variables simbólicas para
%para el modelo
syms A B D K E L V N c b tasa Ibarra Abarra
%PARTE NUMÉRICA
%Deniendo los valores de las constantes
A=2; B=0.5; D=0.5; K=100; E=2;
L=14; V=7; c=70; b=-60; Ibarra=15;
Abarra=8;
%MERCADO DE BIENES
%Función de producción
q=A.*(N.^B).*(K^D)
inversion=Ibarra+b.*tasa
ahorro=Abarra+c.*tasa
%MERCADO DE TRABAJO
%Derivando la función de producción
diff(q,N)
wd=diff(q,N);
ws=E.*N;
%EQUILIBRIBO DE MERCADOS I
%Equilibrio en el mercado de trabajo
solve(wd-ws==0,N);
Neq=solve(wd-ws==0,N);
Weq=E*Neq;
qeq=A*(Neq^B)*(K^D);
%Equilibrio en el mercado de bienes
solve(inversion-ahorro==0,tasa)
tasaeq=solve(inversion-ahorro==0,tasa)
inversioneq=Ibarra+b.*tasaeq
consumo=qeq-inversioneq
%CONSUMO E INVERSIÓN
qeq=A*(Neq^B)*(K^D);
resta=linspace(0,qeq,100);
funciondecre=-resta+qeq;
%
%MERCADO MONETARIO
syms q
P=q.\(L*V)
%Equilibrio en el mercado monetario
peq=(L*V)/qeq
%FUNCIONES ANÓNIMAS
%Rango de Valores
N=linspace(0,10,100);
q=linspace(0,50,100);
tasa=linspace(0,0.1,100);
%Funciones
wd=@(N) N.\(A*B*(K^D)*(N.^B))
ws=@(N) N.*E
q=@(N) A.*(N.^B).*(K^D)
inversion=@(tasa) Ibarra+b.*tasa
ahorro=@(tasa) Abarra+c.*tasa
funciondecre=@(qeq) -resta+qeq;
P=@(q) (L*V)/q
%GRÁFICOS
%Varios gráficos en uno solo
%Gráfico del
subplot(2,3,1)
plot(P(q))
axis([0 6 0 50])
%Gráfico del
subplot(2,3,2)
plot(N,q(N),[Neq Neq],[0 qeq])
axis([0 6 0 70])
%Gráfico del
subplot(2,3,3)
plot(resta, funciondecre(qeq))
axis([0 50 0 50])
%Gráfico del
subplot(2,3,5)
plot(N,wd(N),N,ws(N),[Neq Neq],[0 20])
axis([0 6 0 20])
%Gráfico del
subplot(2,3,6)
plot(inversion(tasa),tasa,ahorro(tasa),tasa,[inversioneq inversioneq],[0 tasaeq])
;
MERCADO MONETARIO
syms q
P=q.\(L*V)
%Equilibrio en el mercado monetario
peq=(L*V)/qeq
FUNCIONES ANÓNIMAS
%Rango de Valores
N=linspace(0,10,100);
q=linspace(0,50,100);
tasa=linspace(0,0.1,100);
%Funciones
wd=@(N) N.\(A*B*(K^D)*(N.^B))
ws=@(N) N.*E
q=@(N) A.*(N.^B).*(K^D)
inversion=@(tasa) Ibarra+b.*tasa
ahorro=@(tasa) Abarra+c.*tasa
funciondecre=@(qeq) -resta+qeq;
P=@(q) (L*V)/q
GRÁFICOS
%Varios gráficos en uno solo
%Gráfico del
subplot(2,3,1)
plot(P(q))
axis([0 6 0 50])
%Gráfico del
subplot(2,3,2)
plot(N,q(N),[Neq Neq],[0 qeq])
axis([0 6 0 70])
%Gráfico del
subplot(2,3,3)
plot(resta, funciondecre(qeq))
axis([0 50 0 50])
%Gráfico del
subplot(2,3,5)
plot(N,wd(N),N,ws(N),[Neq Neq],[0 20])
axis([0 6 0 20])
%Gráfico del
subplot(2,3,6)
plot(inversion(tasa),tasa,ahorro(tasa),tasa,[inversioneq inversioneq],[0 tasaeq])

답변 (1개)

Star Strider
Star Strider 2020년 8월 11일
Since ‘q’ is a function, it must be evaluated as a function.
Try this:
P=@(N) (L*V)./q(N);
then:
subplot(2,3,1)
plot(P(N))
axis([0 6 0 50])
There may be other problems. These are the only ones I looked at.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by