Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
JoshT_student
JoshT_student el 14 de Jun. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Stephen23
Stephen23 el 14 de Jun. de 2018
Editada: Stephen23 el 14 de Jun. de 2018
"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 el 14 de Jun. de 2018
It also seems you are missing the dot before ^ for your matrix math.
exp_numerator= -(a).*((delta).^2).*t ; %This just simplifies things
^
|
Here

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by