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

 Risposta accettata

qxvdjfm
qxvdjfm il 22 Mag 2023

0 voti

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

Più risposte (0)

Categorie

Scopri di più su 建模 in Centro assistenza e File Exchange

Richiesto:

il 22 Mag 2023

Risposto:

il 22 Mag 2023

Community Treasure Hunt

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

Start Hunting!