How to plot the graph between versus m from this non linear equation given as where and also and are constants . Further represents the upper incomplete gamma function

4 件のコメント

Sudhir Sahoo
Sudhir Sahoo 2021 年 4 月 18 日
@Walter Roberson Hello actually here I want to plot the graph between vs ϕ, where and ϕ takes only five value . so how can I plot this equation. on solving the way you have mentioned I got error
Error using fsolve (line 309)
FSOLVE requires all values returned by functions to be of
data type double.
Sudhir Sahoo
Sudhir Sahoo 2021 年 4 月 18 日
@Walter Roberson my code is like
clc;
clear all;
close all;
%{
This code is for phi vs rotation angle by considering Gamma_av
and R as constant
%}
format long g
%% Initialization of the variables of the code;
syms theta_opt phi real
R = [1/2 1/4 1/8 1/16 1/32];
% phi = [pi/8 pi/6 pi/4 pi/3];
R = R(1);
% phi = pi/6;
snrdb = 20;
m = -1/(log(cos(phi)));
% Value of t_min and t_max and K;
t_min = (m + 2) * R/((1 + R)*(((1 + R)^(m +2))-1));
t_max = ((m+2)*R*((1 + R)^(m +2)))/((((1 + R)^(m +2))-1));
% Ke1 = 1/(R(i)*(m +3));
% Ke2 = (((m +2)*R(i)*((1 + R(i))^(m +2)))/((((1 + R(i))^(m +2))-1)))^(1/(m +3));
% K = Ke1*Ke2;
%% Main eauation optimization
% syms theta_opt m real
a = sin(theta_opt).^2;
b = (cos(theta_opt) - sin(theta_opt)).^2;
part1 = (4./(cot(theta_opt) - 1).^2).^((m+2)./(m+3));
part2a = igamma((m+1)/(2*m+6), b*t_min/2);
part2b = igamma((m+1)/(2*m+6), b*t_max/2);
part2c = igamma((m+1)/(2*m+6), a*t_min/2);
part2d = igamma((m+1)/(2*m+6), a*t_max/2);
part2 = (part2a - part2b) ./ (part2c - part2d);
part0 = part1 .* part2;
eqn = part0 - tan(2*theta_opt)
%% Equatoion solving
F = matlabFunction(eqn, 'Vars', [theta_opt, phi]);
% M = linspace(.1,0.5,30);
Phi = [pi/8 pi/6 pi/4 pi/3];
to0 = 1/2;
opt = optimoptions('fsolve','Display','off');
theta_vals = arrayfun(@(m) fsolve(@(t) F(t,phi), to0, opt), Phi)
plot(Phi, theta_vals)
Walter Roberson
Walter Roberson 2021 年 4 月 18 日
Looks plausible.
Sudhir Sahoo
Sudhir Sahoo 2021 年 4 月 19 日
@Walter Roberson Yes I have done that too thanks for your code

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 14 日

1 投票

format long g
t_min = .3, t_max = .8
t_min =
0.3
t_max =
0.8
syms theta_opt m real
a = sin(theta_opt).^2;
b = (cos(theta_opt) - sin(theta_opt)).^2;
part1 = (4./(cot(theta_opt) - 1).^2).^((m+2)./(m+3));
part2a = igamma((m+1)/(2*m+6), b*t_min/2);
part2b = igamma((m+1)/(2*m+6), b*t_max/2);
part2c = igamma((m+1)/(2*m+6), a*t_min/2);
part2d = igamma((m+1)/(2*m+6), a*t_max/2);
part2 = (part2a - part2b) ./ (part2c - part2d);
part0 = part1 .* part2;
eqn = part0 - tan(2*theta_opt)
eqn = 
F = matlabFunction(eqn, 'Vars', [theta_opt, m]);
M = linspace(.1,0.5,30);
to0 = 1/2;
opt = optimoptions('fsolve','Display','off');
theta_vals = arrayfun(@(m) fsolve(@(t) F(t,m), to0, opt), M)
theta_vals = 1×30
0.0069314830628348 0.00580857786032215 0.00476969071649739 0.00383107554970616 0.00300629942402464 0.00230365859998868 0.00172440452642074 0.00126245991980601 0.000905679893063352 0.000638173870072519 0.000442834585897566 0.000303403400001911 0.000205756788619826 0.00013842649511992 9.25693178041045e-05 6.16347434292645e-05 4.09168876360882e-05 2.71147042440712e-05 1.79533691833739e-05 1.18868228260001e-05 7.87482068082966e-06 5.22271731930821e-06 0.000261432834537425 0.000218383853943231 0.000182441265215855 0.000152451203889114 0.000127439225487863 0.000106583202718427 8.91937576217373e-05 7.46930184705892e-05
plot(M, theta_vals)

2 件のコメント

Sudhir Sahoo
Sudhir Sahoo 2021 年 4 月 14 日
Thanks for your answer @Walter Roberson @Matt J
Sudhir Sahoo
Sudhir Sahoo 2021 年 4 月 18 日
@Walter Roberson Hello , here I one thing is that the value of m is discrete like only I have to take ten values of m in random so how to impliment that instead of using linspace function

サインインしてコメントする。

その他の回答 (1 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by