Combine two graphs and perform interpolation function

7 visualizaciones (últimos 30 días)
KIEN WEI LAI
KIEN WEI LAI el 14 de Mayo de 2020
Respondida: Anirudh Singh el 18 de Mayo de 2020
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;

Respuestas (1)

Anirudh Singh
Anirudh Singh el 18 de Mayo de 2020
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

Categorías

Más información sobre Directed Graphs en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by