自作関数の入力引数不足エラーについて
Ältere Kommentare anzeigen
こんにちは.MATLAB初心者です.
あるモデルの相対距離,相対角度を入力値に対して求める関数を作ろうとしているのですが,どうも入力引数エラーが発生してしまい前に進めません.
コードはこちらです.
q1 = [0 0.5 0.5*pi]; %[x,y,theta]
q2 = [-0.4 0.8 0];
x = [0.10, q1, q2 ] %相対距離,方位角の算出に必要な[半径,初期位置ベクトル]
以下,自作関数です
function [l_ik, phi_ik] = relative_parameters(r,x_i,y_i,theta_i,x_k,y_k,theta_k)
%カッコ内は受け取るデータr,x_i,y_i,theta_i,x_k,y_k,theta_kの7つ
bar_y_k = bar_y(r,x_i,y_i,theta_i,x_k,y_k,theta_k)
bar_x_k = bar_x(r,x_i,y_i,theta_i,x_k,y_k,theta_k)
xi_ik = atan((y_i - y_k - r*sin(theta_k))/(x_i - x_k -r*cos(theta_k)));
l_ik = sqrt((x_i - bar_x_k)^2 + (y_i - bar_y_k)^2);
phi_ik = pi + xi_ik - theta_i;
end
複数の入力値の受け渡しが問題なのかなと思いますが,あまりにも時間が溶けていくのでご有識者の方々の力をおかりしたいです.おねがいします!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu 環境と設定 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!