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

 Akzeptierte Antwort

qxvdjfm
qxvdjfm am 22 Mai 2023

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Mehr zu 建模 finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 22 Mai 2023

Beantwortet:

am 22 Mai 2023

Community Treasure Hunt

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

Start Hunting!