Answered
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 ago | 0

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 0

Answered
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 ...

4 years ago | 0

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 0

Answered
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)

4 years ago | 0

| accepted

Answered
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: ...

4 years ago | 1

Answered
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);

4 years ago | 0

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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) ...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 0

| accepted

Answered
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 ...

4 years ago | 0

Answered
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.

4 years ago | 0

| accepted

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

4 years ago | 0

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

4 years ago | 0

| accepted

Answered
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;...

4 years ago | 2

| accepted

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

Answered
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 ...

4 years ago | 0

| accepted

Answered
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 ...

4 years ago | 0

Load more