Insert this equation into a code
Show older comments
Answers (2)
Spectro
on 14 Apr 2020
It should be like this.
numerator = a*b;
denominator = pow2(b*cos(cos(t))) + pow2(a*cos(cos(t)));
r = (numerator/sqrt(denominator))*exp(-0.04*t);
For the calculation itself you have to declare a, b and t.
BN
on 14 Apr 2020
Hi, I create it as a function:
function r = mifun(a,b,t)
%this function calculates r based on a and b and t as inputs
% Detailed explanation goes here
numerator = a*b;
first_part = (b*cos(cos(t)))^2;
second_part = (a*sin(sin(t)))^2;
denominator = first_part + second_part;
denominator = sqrt (denominator);
fraction = numerator/denominator;
r = fraction*exp(-0.04*t);
end
4 Comments
jonathan riley
on 15 Apr 2020
BN
on 15 Apr 2020
Dear Jonathan,
It is necessary to first open a new blank scrip page then paste the function that I wrote completely to it; then you should save this scrip to the current folder with the name of mifun. After you save it, you can use it, for example:
r = mifun(3,2,4) % where 3 is a, 2 is b, and 4 is t
jonathan riley
on 15 Apr 2020
BN
on 15 Apr 2020
You are most welcome.
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
