1
I have a college job where I have to create a routine to calculate the divergent rotational of any function in Matlab.
Researching, I found that I can use the function divergence()
to calculate the user-imputed vector divergent.
I started the code:
clc
clear
%Calcular o divergente da função
i = input('Insira o vetor i: ');
j = input('Insira o vetor j: ');
k = input('Insira o vetor k: ');
div = divergence(i,i,k);
printf(div);
When I insert some letter in the question, it returns the error below (put "2x"):
"Error using input Undefined Function or variable 'x'."
When I just enter numbers, I can get to the part where I calculate the divergent, but it makes that mistake:
"Error using divergence (line 54) U,V,W must all be a 3D arrays."
I would very much like your help, if possible!
Simply recalling that the divergent is calculated by the partial derivative of i in relation to x, j in relation to y and k in relation to z.