2 views (last 30 days)

alpha = 30;

theta_1 = 0:360;

omega_1 = 360;

theta_2 = atan(tan(theta_1)/cos(alpha))

omega_2 = sec(theta_1).*sec(theta_1).*omega_1/((sec(theta_2)).*(sec(theta_2)).*cos(alpha))

If I remove the division, omega_2 is an array, but with it omega_2 is a single value and I don't understand why.

Any help would be greatly appreciated!

Spencer Chen
on 13 Feb 2020

I guess you probably want to use the:

A ./ B

operation instead of the straight divide "/".

Also as a recommendation, break up your expression into smaller pieces for easier debugging. e.g.:

numerator = sec(theta_1).*sec(theta_1).*omega_1;

denominator = (sec(theta_2)).*(sec(theta_2)).*cos(alpha);

answer = numerator ./ denominator;

or even finer pieces.

Blessings,

Spencer

Opportunities for recent engineering grads.

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

Start Hunting!
## 1 Comment

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/505395-taking-in-2-array-variables-my-output-variable-is-a-single-number-rather-than-an-array-any-sugges#comment_797058

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/505395-taking-in-2-array-variables-my-output-variable-is-a-single-number-rather-than-an-array-any-sugges#comment_797058

Sign in to comment.