フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Is there any way I can put a matrix in my defined function

1 回表示 (過去 30 日間)
JoshT_student
JoshT_student 2018 年 6 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello everybody,
This is my defined function:
%This function is for number 2 of project 4.1
%I will use this function to define TRATIO.
function tratio_sol=my_TRATIO(delta, t, x_over_L)
global a L ;
a=0.279e-5; %This is in meters squared per second
L=0.03; %this is in meters
L_squared=L*L; %This just simplifies things
exp_numerator= -(a).*((delta)^2).*t ; %This just simplifies things
inside=(delta).*(x_over_L); %This just simplifies things
numerator_part=(sin(delta)).*(cos(inside)); %This just simplifies things
denominator= cos(delta).*sin(delta) + delta; %This just simplifies things
top=(exp_numerator)./(L-squared); %This just simplifies things
numer_f= numerator_part.*exp(top); %This just simplifies things
tratio_sol= 2*(numer_f./denominator); %This just simplifies things
%THIS COMPLETES MY FUNCTION
Is there any way I can put a matrix for 'delta'? Or no?
  2 件のコメント
Stephen23
Stephen23 2018 年 6 月 14 日
編集済み: Stephen23 2018 年 6 月 14 日
"Is there any way I can put a matrix in my defined function"
Of course, if you write your function to accept a matrix, then it can accept a matrix as an input. As your code contains no explanation of what it is supposed to be doing, you have not explained anything about the algorithm, and you have not explained what you tried or what you expect to get, we have no idea if your code does (or can do) what you want.
Please edit your question and clarify what you are actually trying to achieve.
Michael Horn
Michael Horn 2018 年 6 月 14 日
It also seems you are missing the dot before ^ for your matrix math.
exp_numerator= -(a).*((delta).^2).*t ; %This just simplifies things
^
|
Here

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by