how to find the two unknowns from the nonlinear equation

clc
clear all
format compact
syms k lambda c T b t0 theta h
lambda=600; b=3;
theta=0;
c=5;
k=250;
h=1.75;
TC=(k/T)+c*lambda+(lambda*(c*theta+h)*(exp(theta*t0)-theta*t0-1))/(T*(theta)^2)+(lambda*b*(T-t0)^2)/(2*T);
dTCdt0=diff(TC,t0);
dTCdT=diff(TC,T);
[T,t0]=solve(dTCdt0,dTCdT)
t0=subs(t0);
digits(3)
t0=vpa(t0)
T=subs(T);
T=vpa(T)
p=theta*t0;
TC=subs(TC);
digits(3)
TC=vpa(TC);
TC=round(TC)
z=sqrt((2*k*(h+c*theta)*b)/(b+h+(c*theta)))*(sqrt(3800)-137.816)
This is my code. I am unable to get the answer for the above. I got the error while I was running the code.
Error using sym/solve (line 266)
Specify the variable to solve for.
Error in
prababaseEOQ (line 13)
[T,t0]=solve(dTCdt0,dTCdT)

3 Comments

You have defined theta = 0. And this theta comes in the denominator so the expression TC is NaN. You need to think of this first.
format compact
syms k lambda c T b t0 theta h
TC=(k/T)+c*lambda+(lambda*(c*theta+h)*(exp(theta*t0)-theta*t0-1))/(T*(theta)^2)+(lambda*b*(T-t0)^2)/(2*T);
dTCdt0=diff(TC,t0);
dTCdT=diff(TC,T);
You did not specify which variables are the unknowns.
What are the equations you are attempting to solve?
Why define variables as symbolic, just to overwrite them with numerical values?
I changed the theta value 0 to 0.02. I got the answer. Thank you KSSV.

Sign in to comment.

Answers (0)

Categories

Find more on Optimization in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!