Combine two graphs and perform interpolation function

조회 수: 7 (최근 30일)
KIEN WEI LAI
KIEN WEI LAI 2020년 5월 14일
답변: Anirudh Singh 2020년 5월 18일
Hi, I have two .mat file named as fullboronn1.mat file and fullboronn11.mat file. I have combined the both .mat files to become a single .mat file and produce the graph as shown below. The fullboronn1.mat file represent the red line and the fullboronn11.mat represent the blue diamond line. However, the blue diamond shape graph is not evenly spaced. I used GetData Graph Digitizer software to plot the blue diamond graph before. I want the blue diamond graph to be evenly spaced between every dots. I perform the interpolation function for fullboronn11.mat file but it gives error. Anyone can edit the code for me? Thanks in advanced.
clc;
clear all;
close all;
load fullboronn11.mat
load fullboronn1.mat
hold on
interp_no_ding = 0:1/50:1;
interp_func1 = interp1(fullboronn11(1:644,1),fullboronn11(1:644,2),interp_no_ding,'spline');
ding=plot(interp_no_ding,interp_func1,'o','Color',[0,0,1],'LineWidth',2);
hold on;
h2 = plot(fullboronn1(:,1),fullboronn1(:,2),'-r');
hold off;

답변 (1개)

Anirudh Singh
Anirudh Singh 2020년 5월 18일
Looks like, You forget the to include x and y dimension in plot function:
Try replacing
plot(fullboronn11(1:644,1),fullboronn11(1:644,2),'o',interp_no_ding,interp_func1,'Color',[0,0,1],'LineWidth',2);
inplace of
plot(interp_no_ding,interp_func1,'o','Color',[0,0,1],'LineWidth',2);
If this not work, post th code of files fullboronn11.mat and fullboronn1.mat. So that anyone can try to reproduce this on their hand.
For more information reffer the following link:https://in.mathworks.com/help/matlab/ref/interp1.html#btwp6lt-2_1

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by