Community Profile

# David Hill

##### Last seen: Today
1.702 total contributions since 2017

View all

Contributions in
View by

How can I calculate the Burke ratio?
dailyRateofreturn=diff(value)./value(1:end-1); freeReturn=.00003;%whatever you decide maxRolling=arrayfun(@(n)max(value(1:n)),...

alrededor de 3 horas ago | 0

Gui: equation solving calculator
Not sure if this will help. eqn ='a*x^2+b*x+c'; var = symvar(eqn); for k=1:length(var) syms(var{k}); end EQN=eval(eqn)...

alrededor de 12 horas ago | 0

How to keep the previous iteration in a for loop?
count=1; for i = 2000:max(WL_HVH(:,1)); WL_HVH_year = WL_HVH(WL_HVH(:,1)==i, :); for j = 1:max(WL_HVH_year(:,2)); ...

alrededor de 15 horas ago | 0

| accepted

How to plot x(n) for many values of n?
alpha = 2 x0 = 100; % Initial conditions for n = 1:30 x(n) = (alpha^n)*(x0) end disp(x); plot(1:30,x);

alrededor de 15 horas ago | 0

How to extract the upper diagonal part of a matrix into a 1 dimensional vector ?
If A will always be a 3x3, then B=A([4 7 8]);

alrededor de 17 horas ago | 0

function Soru6 aci=input('Lütfen açıyı giriniz : '); F=input('Lütfen kuvveti giriniz : '); mesnet function mesnet ...

1 día ago | 0

my code won't run or publish
m = 2; n = 1; for i = 1:100000 q = 3*rand(1); if q < 1 m = m/2; n = n/2; elseif q < 2 m = m...

1 día ago | 1

Replace single quotation with single quotation and double quotation
B=[char(34),A,char(34)]; B=['"',A,'"'];%or this as long as A is a character array

1 día ago | 0

function out=showMe(in) n=1; out=executeSub(); function o=executeSub()%I assume you are talking about a nested fun...

1 día ago | 0

for loop showing only last iteration and the graph shows dotted instead of lines
clc close all clear syms x y E v=[x y]; J=jacobian([y,E*(1-x^2)*y-x], v); p=[0 0]; j=subs(J,v,p); a=-8:0.1:8; for E=1:l...

1 día ago | 0

Scatter plot of two matrix of same size
scatter(x(:),y(:));%after reading x and y in, make sure the matrix size is the same and of type double

1 día ago | 0

Plot function with time step
I assume x is time then corresponding to your y-values with the given step starting at zero. x=0:.000999:4.057938;

2 días ago | 1

| accepted

Error when trying to run a function
function [g] = R(a,b,c,d) rou=880; Cd=0.7; Aorifice=1.963495408*(10^(-5)); Vo=7*10^(-5); Beta=1600*(10^5); Ap=(5.026...

2 días ago | 0

How iterate inside a excel file and every 21 rows store values in a matrix?
I don't understand your question completely, but, I would put them all in a single matrix. XY=reshape(XY(1:42,1:2),21,[]);

2 días ago | 1

How do I convert a cell array with different number of values to a matrix
for k=1:length(m) m{k}=[m{k},repmat(nan,1,5-length(m{k}))]; end m=cell2mat(m);

2 días ago | 1

| accepted

Return Indices for x Smallest/Largest Values in Array
[~,idx]=sort(x); minIdx=idx(1:3);%for minimum 3 maxIdx=idx(end:-1:end-2);%for maximum 3

2 días ago | 1

Function Requests and receives from the user the dimensions of the sampled matrix until a proper value is obtained
I would put your input into a continuous while loop and break the loop when the condition is met. function [m,n]=MatrixDimInput...

2 días ago | 0

Calculate a monthly average from 3-hour data
If you want to simplify slightly, 8 readings * 30 days/month = 240 readings per month ... = 377 months = 90480 readings. Truncat...

2 días ago | 0

How can I perform an operation on each element of a vector individually using a for loop?
No loop needed. [a,b]=pol2cart(Zp(:,3),Zp(:,2)); Zp=a+b.*i;

2 días ago | 1

| accepted

Assign a number of random elements to different variables?
v=randperm(40); k=[]; while isempty(k) a=randi(40,1000,6);%you could change 40 to something smaller if you want to limi...

3 días ago | 1

| accepted

How can I plot the following in MATLAB?
Not sure if this is what you are looking for or not. for n=0:8 f=@(x)exp((1-cos(pi*x))/pi.*cos(n*pi*x)); b(n+1)=2*int...

3 días ago | 0

| accepted

change the distance between grid lines
Look at the following function: zticks()

3 días ago | 1

Values substitution of intervals.
x(x>=1400&x<=1500)=0;

4 días ago | 0

Two vectors to matrix sorted on occurrence
labels=5; hours=6; x=histcounts2(a(:,1),a(:,2),[labels,hours]);

4 días ago | 0

| accepted

how to get function value?
syms a; b=2; e=0.9; q=1.2; g=2; k=3; d=0.5; f=(q*b*e/a-d*e)/((q^2)*(e^2)/a+2*e*g); df=diff(f); fvals=eval(subs(f,1:10))...

4 días ago | 0

how to calculate a row of number to be calculate in if else statement matlab
units=[0 800.09 364.73 776.42 695.21 698 338.67 498.05 426.35 713.48]; results=zeros(size(units)); results(units>900...

4 días ago | 0

| accepted

How to use if-function for arithmetic properties properly?
If you are trying to comute the ramanujan sum it should be something like this: function s = ramanujanSum(a,n) f=factor(a); s...

4 días ago | 0

Submitted

RIPEMD160 Hash
RIPEMD160 Hash of character array input of maximum length 8191