MATLAB help for cell disruption modelling [closed] - matlab

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i keep getting the error "Error using -""Matrix dimensions must agree"
for this piece of code. Can anybody help me and identify where i'm going wrong? I should be getting 8 plots of f vs d.
P=500;
N=1:1:8;
a=-0.4;
b=-1;
Kd=700;
d50star=(1./(10.^(Kd*(N.^a)*(P-115).^b)))
w0=0.45;
d=0:0.1:10
d50N0=5;
if d50star < 0.33;
w=(1-(2.3*d50star))*w0
else
w=(3.4-(5.5*d50star))*w0
end
d50=(1-d50star)*d50N0;
f=1-(1./((1+exp((d-d50)/w))))

There are at least two errors in the script:
1) in the last line [f=1-(1./((1+exp((d-d50)/w))))]
d size is 1x101
d50 size is 1x8
The size inconsistency is related to the definition of:
N=1:1:8; and
d=0:0.1:10
2) depending on the algoroth, it could be ./w instead of /w
Hope this helps.

Related

I am trying to use the code to create graphs in MATLAB but its not working [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I need help with my Matlab code. It is not working, it keeps giving me errors on the same line. I don't know how to fix it, can you please help? I am trying to make graphs in Matlab.
clc
num=(1);
dem=[1 3 10 0];
Ls=tf(num,dem);
relocus(Ls)
The error is:
Error in Matlab (line 4)
Ls=tf(num,dem);
Correct the function 'relocus' to 'rlocus'.
num=(1);
dem=[1 3 10 0];
Ls=tf(num,dem);
rlocus(Ls)
clc

Matlab - plot data from array of structs [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have an array of structs. Every struct holds a set of data for one single measure. Matlab gives me an error when I try to plot this data.
Expected one output from a curly brace or dot indexing expression, but there were 361 results.
How should I rewrite my plot code?
plot(result.structArray_A(:).nonArrayValue_X, result.structArray_A(:).nonArrayValue_Y);
I have found a solution. Simply writing the following does work, even if the syntax does look odd:
plot([result.structArray_A.nonArrayValue_X], [result.structArray_A.nonArrayValue_Y]);

I can't find all the errors occurring in my codes [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
For matalb there's an error at line 9, where I define dy(1), but it doesn't say what kind of error.
function dy=pred_prey(t,y)
k=1;
a=2/3;
d=4/3;
f=#(x)cos(x.^2)
r=#(t)integral(f,0,t);
mu=#(t)13/20-(3/5)*exp(-(3/t));
dy(1)=(y(1)+k)*r-a*y(1)*y(2);
dy(2)=-mu*y(2)+d*y(1)*y(2);
dy=dy';
You define r as an anonymous function, but you don't pass any arguments to it when you call it on line 9. The line should be (I assume):
dy(1) = (y(1)+k)*r(t)-a*y(1)*y(2);
Incidentally, you're going to have the same problem on the next line where you call mu with no arguments as well.

Distance measurement in Matlab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have tried the code from the link Ear Image Processing - Finding the point of intersection of line and curve in MATLAB
but seem to get an error as dist2s is undefined on matlab R2013a.Can anyone help me out
That's because you need to create the function (isn't defined by MatLab itself). Try saving this code in a file called dist2s.m and then setting the folder where it's located like current folder:
function out = dist2s(pt1,pt2)
out = NaN(size(pt1,1),size(pt2,1));
for m = 1:size(pt1,1)
for n = 1:size(pt2,1)
if(m~=n)
out(m,n) = sqrt( (pt1(m,1)-pt2(n,1)).^2 + (pt1(m,2)-pt2(n,2)).^2 );
end
end
end
return;
The code is provided in the same answer you refer to.

I is not a real numeric array of class SINGLE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm using the computer vision: VLfeat library to compute a HOG descriptor of an image, and after inputing this code:
cellSize = 8 ;
hog = vl_hog(im, cellSize, 'verbose') ;
I get this error in MATLAB, and when I google it I really can't find any possible explanation:
Error using vl_hog
I is not a real numeric array of class SINGLE.
After going over the code (found here) I'm also not sure what the variable I is:
Hopefully, I haven't missed something elementary ...
library source
As the asker already found out, the I refers to the first input argument.
Hence this should solve the problem:
hog = vl_hog(single(im), cellSize, 'verbose')