this is the code I currently have
clear all; close all; clc
f= @(x) Average1(x)-65;
engineering= 30; % Intiall estimate
function Average = Average1(engineering) % final grade
engineering = fsolve0(f,engineering)
calculus= 55;
chemistry= 76;
physics= 85;
english= 50;
a= calculus+chemistry+physics+english+engineering;
Average = a/5;
end
when I try to run it i don't get any errors or outputs.
I am trying to make a program that will take 4 veriable values and a wanted avereage of 65 to find the 5th veriable (in this case engineering) minimum value to get a overall average of 65. I am unsure of what am doing wrong I know that the answer for Engineering should be 59 to get a average of 65.

 채택된 답변

Torsten
Torsten 2025년 12월 9일
clear all; close all; clc
f= @(x) Average1(x)-65;
engineering= 30; % Intiall estimate
engineering = fsolve(f,engineering)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
engineering = 59.0000
f(engineering)
ans = 1.2486e-08
function Average = Average1(engineering)
calculus= 55;
chemistry= 76;
physics= 85;
english= 50;
a= calculus+chemistry+physics+english+engineering;
Average = a/5;
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Physics에 대해 자세히 알아보기

제품

질문:

2025년 12월 9일

댓글:

2025년 12월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by