I'm having a college assignment where I should create a routine to calculate the divergent rotational of any function in matlab.
Searching, I found that I can use the divergence()
function to calculate the divergent of the vectors imputed by the user.
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 enter some letter in the question, it returns the error below (I put "2x"):
"Error using input Undefined function or variable 'x'. "
When I enter only numbers, I get to the part of calculating the divergent, but it gives this error:
"Error using divergence (line 54) U, V, W must all be 3D arrays. "
I would greatly appreciate your help if possible!
Just remembering that the divergent is computed by the partial derivative of i in relation to x, j in relation to y and k with respect to z.