Community Profile

David Hill

Last seen: Today
1 465 total contributions since 2017

View all

Contributions in
View by

How to use "for" function for looping with 3 variables
No need of for-loops: [a,b,c]=meshgrid(R2,R3,R4); Rs = a./(a+R1)-c./(b+c); Vo = Vin*Rs;

environ 2 heures ago | 0

Looping a function in MATHLAB
No loop needed, just provide Z array to function. Output, y will contain the array of corresponding outputs for the different Z'...

environ 2 heures ago | 0

element wise product matrix-vector
S_t=Y_t.*w';

environ 3 heures ago | 0

| accepted

How to reshape each matrix of cell
for k=1:length(c) c{k}=reshape(c{k},25,9540); end

environ 3 heures ago | 0

| accepted

Solve system of equations where variables are xby1 column
x=A\b%where A is matrix of coefficients and b is a column vector of answers

environ 19 heures ago | 0

Matlab Solve a system of equations for a set of data
You could just solve Ax=b (A\b): E=73*10^9; v=0.33; ey28=-1*10^-6; ex28=-3*10^-6; b=[v*E*(ex28+ey28)/(1+v)/(1-2*v)+E*ex28/...

environ 19 heures ago | 0

Why I get ans = logical 1
Much easier way: A=normrnd(0,1,[100,1]); [~,~,a]=histcounts(A,[-10,-.9957,0,.9957,10]); b=[-1.493;-0.497;0.497;1.493]; Aq=b(...

environ 23 heures ago | 0

b = 3500; Balance=3500; r = 1.06; rr=1.05; for i = 1:30 Balance = Balance*r+b*rr^i; end

environ 23 heures ago | 1

This works just fine for me. data=readmatrix('Data.csv');

1 jour ago | 0

double loop formation question
for j=1:52 jj=j; for i = 1:30 depth_week_j(:,:,i) = GWdepth(:,:,jj); jj = jj + 52; end me...

1 jour ago | 0

| accepted

Value dependant sort of matrix rows
sorted_M8=M8'; sorted_M8(ismember(M8',8))=M8(:,1); sorted_M8=sorted_M8'; sorted_M8(:,1)=8;

1 jour ago | 0

| accepted

Need help with plotting a complicated for loop
function y=f(x) for i=x if i>2 y=x.^2;%you are reassigning y every iteration, your y will be ...

1 jour ago | 0

How can I eliminate the NaN?
x = input('Angle in Radians:'); d=cos(x); f=1; difference = d - f; difference = abs(difference); threshold = .0001; n = 0;...

1 jour ago | 0

| accepted

Typing a long and complicated equation
z=@(y)2*pi*(sqrt((44.56-y)/.16)+1).*sqrt(1+(1./(.32-.32*(sqrt((44.56-y)/.16)+1))).^2); y=0:.01:10;%have no idea what you are in...

2 jours ago | 0

For loop for this ?
A simple matrix would work much better. Vcd=125*(ones(3,10).*[1.2,1.3,1.4]').^(1:10);%this is 10 years, each column with the di...

2 jours ago | 0

bisection method with log
Once you graph your function, you see there are 4 roots. Using the bisection method to find the numerical roots should now be ea...

2 jours ago | 0

How do put the values within a cell in a matrix?
dff1=wholedff{1}; dff2=wholedff{2}; ... but why would you want to do that? That is why we do indexing so we do not have to ha...

2 jours ago | 0

Simpson's 1/3 Rule Implementation Issue (Code Provided)
The following function might help. function o = simp(a,b,f,n) x=linspace(b,a,n+1); o=0; for k=1:n xx=[x(k);(x(k)+x(k+1)...

3 jours ago | 0

Setting variable names inside function based on input arguement in MATLAB
function ans=testNum(z) str = ''; NaN; while isnan(ans) input([str, 'Enter a value for ',z,': ']); ...

3 jours ago | 0

| accepted

Solved

ZigZag - 01
Given a matrix, return the elements that are on the Z form of the matrix. For example - a=[1,2,3; 4,5,6; 7,8,9] ...

3 jours ago

Solved

Seconds
Given the number of seconds after 12 am, find the time in the given format (12/24). If the format is not mentioned, use 24-ho...

3 jours ago

Are there any functions that will return the index of the last string in a cell of strings?
find(ismember(cell,'a'),1,'last');

3 jours ago | 1

| accepted

Symbolic solution to a system of equations
syms a; [1,-1;2,-1]\[a;0];

3 jours ago | 0

How can I add a column of data to a matrix
A1=[A1;b1];

3 jours ago | 0

How do I call a script inside a function?
Why not just use functions? I only use scripts when I am working in the workspace. Unless you are going to call a function more ...

3 jours ago | 0

Applying a string of user inputs within a while-loop
Recommend breaking while loop with if statement: while 1 angle=input(['Enter the angle of trajectory [degrees] : ']); ...

4 jours ago | 1

Matrix dimensions must agree
Several problems I have noticed: a = 0.4; f = 10^6; w = 2*pi*f;%scalar no need for . I0 = 1; b = (0.4/2); mu0 = 4 * pi * 1...

4 jours ago | 0

Sorting a large 3 column data set
If I understand you correctly, can you not just subtract off a constant from both x and y coordinates to reset them to where you...

4 jours ago | 0

| accepted

How can i get the trigonometric function of cos and sin of a variable
Why are the users not entering numbers instead of character arrays? T1 = input('Introduce the value of Theta for row 1 = ');

4 jours ago | 0