generating Sine wave in Graph
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I am trying to plot the following graph :
yi = [3.0 -2.9 4.6 -4.4 4.5]';
ti = [0 1.1 2.2 3.3 4.4]';
plot(ti,yi,'g');
I am getting graph as in figure 1. That is it is triangular wave, but I want sine wave as shown in figure 2.
Can you please help me with it?
Figure 2: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/292662/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/292662/image.png)
Figure 1:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/292663/image.png)
댓글 수: 0
답변 (1개)
Mehmed Saad
2020년 5월 13일
You have 5 data points and you ve to interpolate the data between them
For plotting in blue cross
plot(ti,yi,'bx','MarkerSize',20,'LineWidth',2)
Now interpolated data and save there result in variable tq and yq
% Your interpolation code
Now plot tq and yq on same graph
hold on
plot(tq,yq,'g--','LineWidth',2)
where tq and yq are your interpolated data
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!