I have a data set called curvefit and the following code plot(curvefit,'b-')
When this code is plotted I get this plot image
However when I try to do a subplot with subplot(2,1,1); plot(curvefit,'b-') I get this (actual subplot code to produce image uses subplot(1,1,1) to create larger image, result is the same)
I've cleared my workspace of any extraneous variables, used clf beforehand. Hold on is not on, these plots are plotted seperately. I'm not sure what's going on or how to fix this. Thanks to anybody who can! Here is my code if it helps
figure
set(gcf, 'Position', get(0,'Screensize'));
span=61;
smooth349=smooth(updisplacementP349,span);
subplot(2,1,1); plot(upliftdatesP349,smooth349,'b-')
datetick('x')
curvefit349=fit(upliftdatesP349',smooth349,'sin4');
subplot(2,1,2); plot(curvefit349,'b-');
upliftdatesP349 is a 1 by 3038 row of dates with each date taken per day
updisplacementP349 is a 3038 by 1 vector of data. I'm new to stack overflow so I am not sure what the procedure is on posting exact code because mine pulls data from large text files which I can't post.
curvefit? Is it a matrix with two columns? I've never tried to plot matrices before and would do something likeplot(curvefit(:,1),curvefit(:,2),'b-')instead. When I tried the matrix form (first column x, and second column sin(x)) I did get a weird plot showing the sine wave and a diagonal line (much like yours). Check the plot with matrix link for info on plotting in this manner. You may want to just stick with the plotting of the individual columns.fitcommand. The default way of plotting a cfit value as given by MATLAB documentation here mathworks.com/help/curvefit/curve-fitting.html is the way I described in my original question.