Undefined function or variable 'impact'.

Hey, Ive been stuck in this script for weeks. dont know what's wrong is it the varible "impact".
because it works for my friend but it dont work with me
function [thetadotdot] = acceleration(r,g,a_c,theta,k0)
thetadotdot = ((g.*r.*sin(theta))+(a_c.*r.*cos(theta)))./k0^2;
end
clc;
clear;
g = 9.81;
theta = 33;
vel = zeros(1,10);
tim = zeros(1,10);
AC = zeros(1,10);
i = 0;
for a_c = 1*g:g:10*g
i = i + 1;
AC(i)=a_c;
I = impact(a_c,theta);
vel(i) = I;
tim(i) = 0.75/I;
end
figure
subplot(1,2,1)
plot(AC,vel)
title('Velocity vs acc.');
xlabel('acc');
ylabel('Velocity');
subplot(1,2,2);
plot(AC,tim)
title('Time vs acc.');
xlabel('acc');
ylabel('Time');

3 件のコメント

Sriram Tadavarty
Sriram Tadavarty 2020 年 4 月 5 日
Make sure impact function is present within the matlab path. You can try >> which impact
Raad Alsulaiti
Raad Alsulaiti 2020 年 4 月 5 日
thanks, it helped.
Sriram Tadavarty
Sriram Tadavarty 2020 年 4 月 5 日
Glad that it helped, placing the same in answer

サインインしてコメントする。

回答 (1 件)

Sriram Tadavarty
Sriram Tadavarty 2020 年 4 月 5 日

0 投票

Hi Raad,
Make sure the function 'impact' is present in the matlab path. You can try
>> which impact
Then add the folder in which it is present to the MATLAB path and that will solve.
Thanking you.
Regards,
Sriram

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2015b

タグ

質問済み:

2020 年 4 月 5 日

回答済み:

2020 年 4 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by