필터 지우기
필터 지우기

Unrecognized function or variable 'x'.

조회 수: 1 (최근 30일)
Maria
Maria 2023년 11월 16일
편집: Maria 2023년 11월 17일
Hello.
I don’t understand why I don’t have x defined after running the code, if initially it says errors. Help me please
function F=M36(x)
F=[3*x(1)*x(2) - x(1)^2 - x(2)^2 - 5;
7*x(1)^2 * x(2)^2 - x(1)^4 - x(2)^4 - 155];
options = optimoptions('fsolve','Display','iter');
[~,~] = fsolve(F,[-4,0],options);
[~,~] = fsolve(F,[0,4],options);
disp('Plotting graphs of the left sides of the system equations:')
x=-5:0.1:5;
y= (3/2).*x+ sqrt((13/4).*x.^2+5);
plot(y,x,'b')
hold on
x=-5:0.1:5;
y = sqrt((x^4 + 155) / (7*x^2 - y^2));
plot(y,x,'b')
hold on
grid on
legend('Graphic solution');
end
  댓글 수: 3
Maria
Maria 2023년 11월 16일
편집: Maria 2023년 11월 17일
I want to solve a system of nonlinear equations 3*x(1)*x(2) - x(1)^2 - x(2)^2 = 5;
7*x(1)^2 * x(2)^2 - x(1)^4 - x(2)^4 = 155 create a file - m using the extended function fzero, check the solution using the roots function, and also plot solutions
Walter Roberson
Walter Roberson 2023년 11월 16일
syms x [1 2]
eqns = [3*x(1)*x(2) - x(1)^2 - x(2)^2 == 5;
7*x(1)^2 * x(2)^2 - x(1)^4 - x(2)^4 == 155]
eqns = 
sol = solve(eqns)
sol = struct with fields:
x1: [4×1 sym] x2: [4×1 sym]
subs([x1, x2], sol)
ans = 

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

답변 (1개)

Walter Roberson
Walter Roberson 2023년 11월 16일
F = @(x)[3*x(1)*x(2) - x(1)^2 - x(2)^2 - 5;
7*x(1)^2 * x(2)^2 - x(1)^4 - x(2)^4 - 155];

카테고리

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