why i'm getting wrong answers from a simple equation

조회 수: 1 (최근 30일)
firrou bouteflika
firrou bouteflika 2021년 6월 24일
댓글: firrou bouteflika 2021년 6월 25일
>> t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
>> f = @(t) (2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
>> g = @(t) 1-exp(-((t/9500).^2.2))
>> f(t)-g(t)
>> ans =
-0.0869 0.32398874
-0.1561 0.39063829
-0.2510 0.31369048
-0.3581 0.31787694
-0.4370 when answers should be ....
-0.5654 ...
-0.6286 ..
-0.7437
-0.8268
-0.8748
-0.9194

답변 (1개)

Image Analyst
Image Analyst 2021년 6월 24일
My guess is that you've probably misplaced some parentheses. Check them very carefully. And you don't need the @(t) - you can simply do
t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
f = (2.2/9500).* ((t/9500).^1.2).*exp(-((t/9500).^2.2))
g = 1 - exp(-((t/8900).^2.2))
results = f - g
% Plot things below.
plot(t, f, 'b.-', 'LineWidth', 2, 'MarkerSize', 20);
hold on;
plot(t, g, 'r.-', 'LineWidth', 2, 'MarkerSize', 20);
grid on;
legend('f', 'g', 'Location', 'north');
  댓글 수: 1
firrou bouteflika
firrou bouteflika 2021년 6월 25일
thank you but i'm soryy i made a stupid mistake the f equation results should be arranged from min to max after that we do results = f - g please help me do that
and also a small mistake that doesnt matter g = 1 - exp(-((t/8900).^2.2)) 8900 should be 9500

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

카테고리

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

제품


릴리스

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by