Tips for life, tips for tech

Here is the code to plot a data point to a 2D diagram.

plot(x,y) %plot the line
yi=interp1(x,y,a)
% a is a real number of the
% x-axis value of the data point
hold on
plot(a,yi,'*')

For example:

x=[0:0.01:1];
y=[0:10:1000];
plot(x,y);
% Now add a data point with x=0.25
yi=interp1(x,y,0.25);
hold on;
plot(0.25,yi,'*')

Reply in English

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: