matlab-figure

Ploting constant contours in the same color in matlab

痴心易碎 提交于 2019-12-13 08:35:09
问题 [x,y] = meshgrid(-10:1:10,-10:1:10); idx = (x~=0)&(y~=0); contour(x(idx)/(x(idx).^2+y(idx).^2).^(3/2),y(idx)/(x(idx).^‌2+y(idx).^2).^(3/2))‌​; the output is white page! 回答1: "delete" the points you do not want: [x,y] = meshgrid(-10:0.1:10,-10:0.1:10); Idontwantthis = (x.^2+y.^2)<1; data= x./(x.^2+y.^2).^(3/2)+y./(x.^2+y.^2).^(3/2); data(Idontwantthis)=NaN; contourf(data,20); Note that I replaced / by ./ I also added more points, as your meshgrid is tiny. This is what the result looks like if

Storing data in nested functions in GUIDE, Matlab

孤街醉人 提交于 2019-12-13 07:37:40
问题 I'm trying to create a simple gui in matlab and have some problems. The main idea of this simplified program is that I have a slider, it determines the frequency of a sine wave. Two plots show the resulting signal. A high res in 44100 Hz, and a low res in 100 Hz. Another slider determines the length of the signal being plotted (also this measured in Hz). The original program has quite a few more sliders to add more frequencies, but since I didn't think it was important I tried to scale it

How to make a matrix positive definite whose elements lie in the range 0.8 to 1 and -0.8 to -1

北慕城南 提交于 2019-12-13 05:49:39
问题 I have been given a positive definite matrix. Then I have modified the matrix in such a way that all the values of that matrix lie in the range 0.8 to 1 or -0.8 to -1. But after that the matrix no longer remain a positive definite matrix. I have used the [R,p]=chol(NewMat) function to verify this. How will I make the modified matrix positive definite? clc clf clear all close all Matrix=csvread('new1.csv'); %reading the csv file. fid1 = fopen('new2.csv'); X = textscan(fid1, '%s%s%s%s%f%f%f',

Matlab: Videowriter creates video with only section of figure

梦想与她 提交于 2019-12-13 04:56:45
问题 I made a script that plots an animation of the orbit of Phobos, MEX and MAVEN spacecraft around Mars. I want a video of this animation. It works almost perfect but for some reason the video created is a zoom of the animation in Matlab and I can't figure out why. This is my code (Ignore everything with cspice, this is a toolbox to receive positions of objects in space): clear %Load kernels cspice_furnsh( 'de421.bsp' ) cspice_furnsh( 'MAR085.BSP' ) cspice_furnsh( 'maven_v03.tf' ) cspice_furnsh(

Adding text to y-axis - MATLAB

不羁岁月 提交于 2019-12-13 04:19:25
问题 I have a plot and I would like to add on the y-axis the values of 1σ, 2σ, 3σ etc. instead of numbers assigned by MATLAB. However, the x-axis remains as normal. Is there any way to do this? Thanks 回答1: Changing the tick labels is easy, as you can see from the following example. x = 0:pi/500:2*pi; y = sin(x); plot(y, x); set(gca, 'YTick', [0 pi/2 pi 1.5*pi 2*pi]); set(gca, 'YTickLabel', {'0', 'pi/2', 'pi', '3/2 pi', '2 pi'}); However, the (la)tex interpreter is still unsupported and hence you

How can i set a specific and irregular tick on a Matlab axis?

允我心安 提交于 2019-12-13 03:49:28
问题 With Open-BCI, i got values (sampled at 255Hz) that i want to plot on matlab. However, i would like specific ticks on the x axis (i think it's the correct term) to match the acquisition protocol. It follows a 6-2-6-2 seconds pattern. What i mean is : - T=0s => xtick="Image1" - T=6s => xtick="Image2" - T=8s => xtick="Image3" - T=14s => xtick="Image4" - T=16s => xtick="Image5" etc... I want to plot the whole signal, and then change the X axis ticks to show only those values. However i struggle

Matlab: change order of entries in Figure legend

我只是一个虾纸丫 提交于 2019-12-13 02:26:58
问题 I have a Figure file where I would like to change the order of the entries (e.g., put the first entry as third one). I saved this Figure.fig long time ago so I am not sure if I can recover the original code. Here I show you my plot: I want the legend elements to be in a decreasing order ( as in the picture) but due to a mistake my second entry is referring to the wrong plot (it says "25 years" but the plot is actually referred to the lowest trend, corresponding to the "9 years" trend). Can I

Using multiple colormaps on same axis with ezsurf

老子叫甜甜 提交于 2019-12-13 02:12:00
问题 I'm trying to plot several symbolic functions in the same subplot. Using ezsurf makes it easy to plot symbolic functions, but it doesn't seem to be very configurable. I can't colour the individual graphs (see the figure below). They all automatically take the normal jet colourmap. How can they use different colormaps? edit : Here's the new code I'm running using freezeColors as suggested in the answer: subplot(2,2,4) for i = 1:numClasses f(i) = M_k(i)/sum(M_k); freezeColors hold on ezsurfc(x

Parameter Estimation of Kinetic model

廉价感情. 提交于 2019-12-13 00:28:28
问题 I have a chemical kinetic model (2-Tissue compartment Model) with Constrained K3(where K3 is rate constant) I have modelled plasma function along with Chemical kinetic model in order to plot the output characteristics I would like to estimate the Rate Constant k3 from the Code below function c_t = output_function_constrainedK3(t, a1, a2, a3,b1,b2,b3,td, tmax,k1,k2,k3) DV_free= k1/(k2+k3); K3 = k3*((k1/k2)/DV_free); K_1 = (k1*k2)/(k2+K3); K_2 = (k1*K3)/(k2+K3); c_t = zeros(size(t)); ind = (t >

Extract surface from matlab .fig

夙愿已清 提交于 2019-12-12 23:19:32
问题 I have a matlab .fig file which contains some points and a surface fitted to them. I want to extract the surface from the figure, and I would like to have both the vertices and the faces. Could you please provide me some hints on how to achieve this? My figure can be found here: https://drive.google.com/file/d/0By376R0mxORYU3JsRWw1WjllWHc/view?usp=sharing and I would like to extract the surface without the blue points. EDIT: it is not a duplicate, see my comment below as to why. 回答1: The data