怎么写一个有正弦数据的矩阵,其他都是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

 Réponse acceptée

qxvdjfm
qxvdjfm le 22 Mai 2023

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur 建模 dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!