MATLAB: How to solve and plot a function with more than 3 arguments all having different array length.

MATLABsolve function with multiple arguments different array length

For eaxmple for the given function below, solve for K for all possible combinations of input argumnets
K=cos(teta)*sin(alfa)-tan(teta+alfa-fi)+sin(teta-beta+alfa)*tan(beta)^2
alfa : 0 to 40 degrees wtih 5 degrees increment
fi : 20 to 40 degrees wtih 8 degrees increment
teta : 0 to 10 degrees wtih 2 degrees increment
beta : 1 to 2 degrees wtih 0.1 increment
Then, after solving for K
How can I plot variaition of K with 1 or 2 variable input argumnets keeping the rest of the arguments constant
For example
Ploting variation of K with fi and alfa (for teta=8 and beta = 1.5)
or
Ploting variation of K with fi and (for teta=8 , beta = 1.5 and alfa = 30)
Best wishes

Best Answer

alfa = reshape(0:5:40, [], 1);
fi = reshape(20:8:40, 1, []);
teta = reshape(0:2:10, 1, 1, []);
beta = reshape(1:0.1:2, 1, 1, 1, []);
K = cos(teta) .* sin(alfa) - tan(teta + alfa - fi) + ...
sin(teta - beta + alfa) .* tan(beta) .^ 2;
Now the question is what "plotting" means for 4D data.
Ploting variation of K with fi and alfa (for teta=8 and beta = 1.5)
alfa = reshape(0:5:40, [], 1);
fi = rehape(20:8:40, 1, []);
teta = 8;
beta = 1.5;
K = cos(teta) .* sin(alfa) - tan(teta + alfa - fi) + ...
sin(teta - beta + alfa) .* tan(beta) .^ 2;
% Maybe:
surface(alfa, fi, K.');
view(3);