One program is not running after differentiation
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Locate the problem and suggest for correction:
clear all; clc;
%%%%% parameter declaration %%%
g1 = 10^(-4);
g2 = 6;
g3 = 0.66;
g4 = 0.08;
dp = 0;
dc = 0;
d3 = 0;
d4 = 0;
rv = 2.5;
r1 = 12;
k02 = 200;
k04 = 0.01*k02;
c = 1;
% Main Part %
syms om rc real
f1 = om + dp - dc + 1i*g1;
f2 = om + dp + 1i*g2;
f3 = om + dp + d3 + 1i*g3;
f4 = om + dp + d3 + d4 + 1i*g4;
M = (f1*f2 - rc^2)*(f3*f4 - rv^2) - f1*f4*r1^2;
Fp = -((f3*f4 - rv^2)*f1*k02)/M;
Fm = -((M + (f1*f2 - rc^2)*rv^2)*k04)/(M*f4);
G = (f1^2*r1^2*rv^2*k02*k04)/M^2;
kp = (om/c) + 0.5*(Fp + Fm) + sqrt((0.5*(Fp + Fm))^2 + G);
% Define Grn as a function of rc by differentiating kp w.r.t. only om (not by rc) and putting om = 3
Grn = @(rc) double((1/c)*(real(diff(subs(kp, om, 3), om))));
% Define range of rc values
rc_values = linspace(0, 10, 100);
% Evaluate Grn for each rc value
Grn_values = arrayfun(Grn, rc_values);
% Plot Grn versus rc
plot(rc_values, Grn_values, 'LineWidth', 1.5, 'Color', 'r');
xlabel('rc');
ylabel('Grn');
title('Grn versus rc');
0 commentaires
Réponses (1)
Torsten
le 2 Avr 2024
Modifié(e) : Torsten
le 2 Avr 2024
clear all; clc;
%%%%% parameter declaration %%%
g1 = 10^(-4);
g2 = 6;
g3 = 0.66;
g4 = 0.08;
dp = 0;
dc = 0;
d3 = 0;
d4 = 0;
rv = 2.5;
r1 = 12;
k02 = 200;
k04 = 0.01*k02;
c = 1;
% Main Part %
syms om rc real
f1 = om + dp - dc + 1i*g1;
f2 = om + dp + 1i*g2;
f3 = om + dp + d3 + 1i*g3;
f4 = om + dp + d3 + d4 + 1i*g4;
M = (f1*f2 - rc^2)*(f3*f4 - rv^2) - f1*f4*r1^2;
Fp = -((f3*f4 - rv^2)*f1*k02)/M;
Fm = -((M + (f1*f2 - rc^2)*rv^2)*k04)/(M*f4);
G = (f1^2*r1^2*rv^2*k02*k04)/M^2;
kp = (om/c) + 0.5*(Fp + Fm) + sqrt((0.5*(Fp + Fm))^2 + G);
% Define Grn as a function of rc by differentiating kp w.r.t. only om (not by rc) and putting om = 3
Grn = 1/c*real(subs(diff(kp,om),om,sym('3')));
fplot(Grn,[0 25],'LineWidth', 1.5, 'Color', 'r');
xlabel('rc')
ylabel('Grn')
title('Grn versus rc')
2 commentaires
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!