Plotting the behavior of a diagonal matrix

1 view (last 30 days)
Dushani Munasinghe
Dushani Munasinghe on 30 Dec 2019
Commented: Csaba on 2 Jan 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 Comments
KALYAN ACHARJYA
KALYAN ACHARJYA on 30 Dec 2019
Edited: KALYAN ACHARJYA on 30 Dec 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 on 2 Jan 2020
You have only vectors in your code, there is no matrix. What are you referring to?

Sign in to comment.

Answers (0)

Categories

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!