how to draw peaks in specific locations?
조회 수: 4 (최근 30일)
이전 댓글 표시
i need to draw peaks in specific coordinations how can i do it ?
답변 (1개)
Star Strider
2014년 8월 2일
Here is one way:
P = @(x,c,w) exp(-w*(x-c).^2); % Function to calculate peaks
W = 2; % Width (constant here, can vary as a vector if you like)
C = 5:5:15; % Peak centers
x = linspace(0,20,250); % Define ‘x’ vector
pks = zeros(size(x)); % Preallocate ‘pks’
for k1 = 1:length(C) % Loop through ‘C’ (centers) vector
pks = pks + P(x,C(k1),W);
end
figure(1) % Plot
plot(x,pks)
grid
produces:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175339/image.png)
댓글 수: 13
Star Strider
2014년 8월 5일
I see you posted that Question and Image Analyst provided an appropriate Answer. Accepting Image Analyst’s Answer and mine here would be an appropriate response from you.
참고 항목
카테고리
Help Center 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!