Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
59 views

Why my code produce an incorrect graph in MATLAB?

Does anyone know why my MATLAB code is give an incorrect graph? I want to plot f(x)=exp(-x)-2*x. The codes as follows. clear all; clc; h=0.01; x=-1:h:1; f=exp(-x)-2*x; plot(f,x,'color','r'); grid on; ...
Ongky Denny Wijaya's user avatar
3 votes
1 answer
877 views

How to draw a stair-step graph using MATLAB for given value?

I want to draw a step graph using MATLAB. In the X-axis, the value starts from 0 and increases like: 0, 0+20=20, 0+20+50=70, 0+20+50+80=150, 0+20+50+80+50=200... and corresponding Y-axis values are: Y ...
Tina's user avatar
  • 111
0 votes
1 answer
592 views

Matlab - adding a timer to a graph

I am need to add a timer to a graph in matlab and dynamically update, similar to shown in picture. It will not run in real time, with 1 minute equal to around 1 second of real time. It needs to run ...
Vladamir 's user avatar
1 vote
1 answer
5k views

Matlab How to Break Y-Axis and Put Infinity at Top

I am trying to break the y-axis of a plot and put Infinity as my top point, but I can't seem to modify the y-axis labels. Ideally, I'd also like to get rid of that curve ~ line that breaks the plot ...
Veridian's user avatar
  • 3,667
0 votes
2 answers
152 views

One of the graphs is not plotting in MATLAB

I have three graphs to plot. They all plot fine alone, but when I want the graphs plotted in separate windows, the second graph is not plotted. This first graph plots fine: function wave = carrier( ...
Hamoudy's user avatar
  • 589
2 votes
2 answers
350 views

matlab: plot area continues after data ends

I have a simple plot in Matlab but as you can see from the screenshot. There is a lot of white space on the right side of the graph after the end of the data series. Any idea how to get rid of ...
natsuki_2002's user avatar
  • 25.4k
6 votes
7 answers
18k views

How to draw good looking arrows in Matlab?

I have been trying to draw arrows in Matlab in my figure but they all look terrible. Also, I want my arrowhead to be a solid triangle, not a V. I tried using the packages available on the Matlab File ...
Veridian's user avatar
  • 3,667
0 votes
1 answer
393 views

How to programmatically draw a line in MATLAB?

I am trying to draw an arbitrary line on a figure in matlab (off of a plot) and I don't know what command I can use. I tried using the arrow package, but I'm getting bad results
Veridian's user avatar
  • 3,667
1 vote
2 answers
7k views

Using findpeaks and minpeakdistance in MATLAB to find peaks separated by distance rather than index

I'm trying to get the x-coordinates of peaks in a MATLAB figure (example attached). I've been using findpeaks, but it doesn't seem to like the fact that I'm plotting points rather than lines. I won't ...
Nick Sweet's user avatar
  • 2,139
2 votes
1 answer
106 views

Index annotation on a Matlab Plot

I'm facing the following issue: I'm analyzing the relationship between a certain impedance value (Complex) and Temperature. The impedance is calculated for a range of Temperature values and then I ...
user2393624's user avatar
1 vote
0 answers
919 views

matlab: cutting figure when resizing for export

I have a small problem. When plotting figure like that: a2 = subplot(2,1,2, 'Parent', handles.cpd_plot, 'Position', [0.15, 0.1, 0.80, 0.15]); a1 = subplot(2,1,1, 'Parent', handles.cpd_plot, '...
Art's user avatar
  • 1,345
0 votes
1 answer
164 views

Matlab: Using surf within a uipanel

I have a 2d matrix containing 4 possible different values. I've used surf to display it as a like a chess board which works fine. Now i'm building a UI for my project (w/o GUIDE) and I'm trying to ...
Guy Wald's user avatar
  • 599