Plotting the behavior of a diagonal matrix

1 visualizzazione (ultimi 30 giorni)
Dushani Munasinghe
Dushani Munasinghe il 30 Dic 2019
Commentato: Csaba il 2 Gen 2020
I have a diagonal matrix of N th power. Eventhough I plot the variation of matrix element with N, I am not getting the expected plot. Basically I want to find the variation of diagonal matrix with power N when eigen decomposition is performed.
The code is,
clc;
close all;
clear all;
%parameters
c=3*10^8;
lambda_0=1559*10^(-9);
lambda_p=1560.7*10^(-9);
lambda_s=1580*10^(-9);
gamma=0.011;
d_slope=0.03e3;
d_slope1=-0.10e3;
P_p=1;
L=250;
%range
m=1:100;
%equations.
delta_beta=((-2*pi*c)/lambda_0^2)*d_slope*(lambda_p -lambda_0 )*(lambda_p -lambda_s).^2;
k=delta_beta+2*gamma*P_p;
g = ((-delta_beta).*(delta_beta./4+gamma*P_p)).^(1/2);
for j=1:length(m);
D(j)=(1./(g.^(m(j)))).*(g.*cosh(g.*L)+sinh(g.*L).*(sqrt(gamma*P_p^2-(k./2).^2))).^(m(j));
end
plot(m,D);
  2 Commenti
KALYAN ACHARJYA
KALYAN ACHARJYA il 30 Dic 2019
Modificato: KALYAN ACHARJYA il 30 Dic 2019
Are you refering diagonal elements of D matix? Though D is not a square matrix, how you expression the diagonal elements?
>> whos D
Name Size Bytes Class Attributes
D 1x100 800 double
What about n, in the code there is no N/n, is it m?
Csaba
Csaba il 2 Gen 2020
You have only vectors in your code, there is no matrix. What are you referring to?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by