why i'm getting wrong answers from a simple equation
조회 수: 1 (최근 30일)
이전 댓글 표시
>> 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
댓글 수: 0
답변 (1개)
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');
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!