怎么写一个有正弦数据的矩阵,其他都是0。

大概是这样
0 0 0 1 0 0 0 0 0 0 0 0 0
0 0.5 0 0.5 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0.5 0 0.5 0
0 0 0 0 0 0 0 0 0 -1 0 0 0

 Respuesta aceptada

qxvdjfm
qxvdjfm el 22 de Mayo de 2023

0 votos

clear;
JD=0:45:360;
JG=fix(2*sind(JD))/2
JG1=flip(unique(JG))
[~,row] = ismember(JG,JG1)
col=1:length(JD)
out=zeros(length(unique(JG)),length(JD))
out(sub2ind(size(out),row,col))=JG

Más respuestas (0)

Categorías

Más información sobre 建模 en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Mayo de 2023

Respondida:

el 22 de Mayo de 2023

Community Treasure Hunt

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

Start Hunting!