Comme posso generare i risultati come hyperlink?
古いコメントを表示
Cerco di execute questo su matlab online però alla fine, il TEX e PDF non sono scaricabili. Come posso farlo che si possono scaricare via matlab online?
% Define symbolic variables
syms A B C t
% Define the matrix ρ(t)
rho_t = [0, (1/8)*(1i - 3*sqrt(7))*A*exp(-t/2), (1/8)*(1i + 3*sqrt(7))*A*exp(-t/2); ...
B*exp(-(3/4)*1i*(sqrt(7) - 1i)*t), -B*exp(-(3/4)*1i*(sqrt(7) - 1i)*t), -B*exp(-(3/4)*1i*(sqrt(7) - 1i)*t); ...
C*exp((3/4)*1i*(sqrt(7) + 1i)*t), C*exp((3/4)*1i*(sqrt(7) + 1i)*t), C*exp((3/4)*1i*(sqrt(7) + 1i)*t)];
% Simplify the matrix
rho_t = simplify(rho_t, 'Steps', 50);
% Compute eigenvalues and eigenvectors symbolically
tic
[D, P] = eig(rho_t);
D = diag(D); % Extract diagonal eigenvalues
P = simplify(P, 'Steps', 50); % Simplify eigenvectors
P_inv = inv(P);
P_inv = simplify(P_inv, 'Steps', 50);
toc
% Display results
disp('Eigenvalues (D):');
disp(D);
disp('Eigenvector matrix (P):');
disp(P);
disp('Inverse of P (P^-1):');
disp(P_inv);
% Export to LaTeX
latex_rho = latex(rho_t);
latex_D = latex(diag(D));
latex_P = latex(P);
latex_P_inv = latex(P_inv);
% Write to a .tex file
fid = fopen('diagonalization.tex', 'w');
fprintf(fid, '\\documentclass{article}\n\\usepackage{amsmath}\n\\begin{document}\n\n');
fprintf(fid, 'The matrix $\\rho(t)$ is:\n\\begin{equation}\n\\rho(t) = \\begin{pmatrix}\n%s\n\\end{pmatrix}\n\\end{equation}\n\n', latex_rho);
fprintf(fid, 'The diagonal matrix $D$ is:\n\\begin{equation}\nD = \\begin{pmatrix}\n%s\n\\end{pmatrix}\n\\end{equation}\n\n', latex_D);
fprintf(fid, 'The eigenvector matrix $P$ is:\n\\begin{equation}\nP = \\begin{pmatrix}\n%s\n\\end{pmatrix}\n\\end{equation}\n\n', latex_P);
fprintf(fid, 'The inverse of $P$ is:\n\\begin{equation}\nP^{-1} = \\begin{pmatrix}\n%s\n\\end{pmatrix}\n\\end{equation}\n\n', latex_P_inv);
fprintf(fid, '\\end{document}\n');
fclose(fid);
% Generate PDF (requires MATLAB to export figure)
figure;
text(0.1, 0.9, 'Matrix \rho(t):', 'FontSize', 12);
text(0.1, 0.8, char(rho_t), 'FontSize', 10);
text(0.1, 0.6, 'Diagonal Matrix D:', 'FontSize', 12);
text(0.1, 0.5, char(diag(D)), 'FontSize', 10);
text(0.1, 0.3, 'Eigenvector Matrix P:', 'FontSize', 12);
text(0.1, 0.2, char(P), 'FontSize', 10);
text(0.1, 0.1, 'Inverse of P (P^{-1}):', 'FontSize', 12);
text(0.1, 0.0, char(P_inv), 'FontSize', 10);
axis off;
exportgraphics(gcf, 'diagonalization.pdf', 'ContentType', 'vector');
close(gcf);
disp('LaTeX code saved to diagonalization.tex');
disp('PDF output saved to diagonalization.pdf');
Grazie
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
