已回答
Why does my ticks/ticks label not match the colour in my colour bar?
Not sure how to do it programatically but in the figure window you can go to "Edit -> Colormap..." and then move the little arro...

4 years 前 | 0

已回答
Adding RAM would it speed up the computations done by Matlab?
Increasing your RAM will only really be beneficial for operations on large matrices. If you are struggling with the speed of a s...

5 years 前 | 1

| 已接受

已回答
Find element index of one array which is equal to the values from another array
A = [1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4]; B = [1,1,1,1,1,1,3,3,3,3]; u=unique(B); C=[]; for i=1:numel(u) C=[C find(A...

5 years 前 | 1

| 已接受

已回答
What timestep does my ode15s solver use?
Assuming you call ode15s with [t,y]=ode15s... then you can just use diff(t) which will show you the difference between each of...

5 years 前 | 0

已回答
Solving a cubic function to get one numeric result?
You aren't going to solve this properly by getting an output of one numerical solution because a cubic equation does actually ha...

5 years 前 | 0

已回答
How can I change the title of variables ?
Output=yhat; Unemployment=URhat; Consumption=chat; wage=what; You can always also use: clear vars yhat URhat chat what if ...

5 years 前 | 0

已回答
overly convoluted elseif condition
function y=gain(x) for jj=1:4 p(jj)=1-jj/128; end if x<=4 y=p(x); else y=1; end end I have assum...

5 years 前 | 0

已回答
Can I run the same Simulink model in different Matlab sessions at the same time? Or would they get mixed up?
I can't specifically answer for Simulink because I've never used it but standard Matlab scripts would be fine with this. I imagi...

5 years 前 | 0

已回答
I have an array for y-values and one for x-values, the x-values don't stat from 0, How to plot this?
Assuming that you want these x values to be the ones displayed on the x-axis then it's as simple as: plot(x,y)

5 years 前 | 0

| 已接受

已回答
Making my function run for multiple input values
You could call the function inside a ‘for’ loop. That would enable you to feed in the different input values. For example: ...

5 years 前 | 1

已回答
Count how many numbers are above -1 in matrix
To find the locations of your values you can use idx = find(x>-1); And to get the values you can use val = x(idx);

5 years 前 | 0

已回答
How can i generate 3 random points within a 2x2m grid?
I think you were on the right lines but you need to subtract one from your x and y: x=rand(1,3)*2-1; y=rand(1,3)*2-1; That'll...

5 years 前 | 0

已回答
Collapse contour plots on a single plot
If you just want them all on a single plot then just do: contour(x1,y1,z1) hold on contour(x2,y2,z2) and so on... If you wa...

5 years 前 | 0

| 已接受

已回答
Unable to predict data well enough
I am far from an expert in this area but I'd guess that you are struggling to get a good preciction because you don't have enoug...

5 years 前 | 1

| 已接受

已回答
Problem in drawing curves after solving ode equations
I think your issue comes from the y(:,2)-N_0 part of your r_R expression. This is asking to take a number away from a number...

5 years 前 | 0

| 已接受

已回答
How to convrt parts of grayscale to RGB
This should do the trick: A = rgb2gray(imread('image.png')); A = cat(3, A, A, A); s=size(A); for i=1:s(1) for j=1:s(2) ...

5 years 前 | 0

| 已接受

已回答
How can I get rid of neighbour data?
So I will preface this by saying there are probably more efficient ways but as you mentione using a for loop you could begin wit...

5 years 前 | 0

| 已接受

已回答
how can i sum
You can make a simpler solution by just doing: A(A<0)=0; sum(A') If you want to retain the original A matrix then create a co...

5 years 前 | 1

已回答
return many value in function.
You do have c5 in your function line. It currently says: function [c1,c2,c3,c5] = calc_centroid(data) Perhaps, just swapping t...

5 years 前 | 0

| 已接受

已回答
hold on for double plots in one loop
You just need to move the figure command or you’ll get two new figure windows. This would be something like: figure for ...

5 years 前 | 0

已回答
Creating a function that goes through a Matrix and scans for any values lesser than 0 (so -1 for example) ?
For a matrix A A(A<0)=0 will convert all negative values to zeros.

5 years 前 | 0

| 已接受

已回答
Why array of strings are concatenated?
You could just store this in a cell array instead - with one parameter inside each cell

5 years 前 | 0

已回答
Finding the last maximum value in a vector
I think this should do it for you: idx = max(find(A==max(max(A))))

5 years 前 | 0

| 已接受

已回答
for loop within for loop
I don't know what you want to do inside those for loops so I can't give you full code but the loops you'll want are: for i=1:4;...

5 years 前 | 2

| 已接受

已回答
Unwanted line connecting last point of current plot to the starting one of the next plot
a = [100e6,120e6,130e6]; %semi major axes of different orbits e = [0.7,0.8,0.9]; %eccentricity of different orbits dtheta = [9...

5 years 前 | 1

| 已接受

已回答
how to duplicate the values in one matrix create another matrix of specific dimension
Assuming you want the rest of the larger matrix to be zeros, then you could use: s=size(A); B(1:s(1),1:s(2)) = A; This will s...

5 years 前 | 0

| 已接受

已回答
Acquire data from a cartesian diagram in pdf format
I don't think there is an automatic way to do this, but you could use GRABIT from the File Exchange which will allow you to grab...

5 years 前 | 1

| 已接受

已回答
Zero a cell matrix with varying number of zeros
I'm not 100% sure I follow, but as I understand you want to take some list of columns and turn all elements in that column to ze...

5 years 前 | 0

已回答
Compare results of different step size using Euler's method
I have made a few tweaks to your code and it will now allow you to alter one parameter value (the time step size) and produce a ...

5 years 前 | 0

| 已接受

已回答
finding the position of elements in a matrix if the elements are repeated
You could use pos = find(ismember(Z, M, 'rows') == 1); instead, although as I have commented above, I don’t think your ...

5 years 前 | 0

加载更多