필터 지우기
필터 지우기

Solving a system of equations.

조회 수: 1 (최근 30일)
Christopher Marlar
Christopher Marlar 2016년 1월 26일
댓글: Walter Roberson 2016년 2월 3일
For
and
where
How do I write a code that will take a given x and y value and output an alpha and delta value?
  댓글 수: 1
jgg
jgg 2016년 1월 26일
Do you want a numerical solution or a symbolic solution?

댓글을 달려면 로그인하십시오.

답변 (1개)

Vineeth Kartha
Vineeth Kartha 2016년 2월 3일
Hi Christopher,
The following lines of code will do the trick:
>> syms alpha delta
>> solver = @(x,y) solve(x ==alpha / delta^2 , y ==(( (3*alpha*(1+delta)^2) + ( (1+alpha)*(1+alpha*delta^2)))^(0.5))/((1+alpha)^2), alpha, delta,'IgnoreProperties', true);
>> sol = solver(x,y);
Pass the desired values of x and y to the function named "solver". This will return a structure that contains the values of "alpha" and "delta", for the given x and y values.
Refer to the MATLAB documentation of solve for more details.
  댓글 수: 2
Christopher Marlar
Christopher Marlar 2016년 2월 3일
This is what I get as an output when I try to run the solver.
Warning: Possibly spurious solutions.
In symengine
In mupadengine/evalin (line 102)
In mupadengine/feval (line 158)
In solve (line 292)
In Alpha_Delta>@(x,y)solve(x==alpha/delta^2,y==(((3*alpha*(1+delta)^2)+((1+alpha)*(1+alpha*delta^2)))^(0.5))/((1+alpha)^2),alpha,delta,'IgnoreProperties',true)
Walter Roberson
Walter Roberson 2016년 2월 3일
Your delta is always squared so algebraically both negative and positive values are valid. The message is warning you that multiple solutions have been returned but that they might not all make sense in the overall context.

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by