Risposto
How to append in a while loop?
Where is 'a' assigned? Lots of guessing here, but this might help you. limit =0.01; Ad= (linspace(-2.5,2.5,26))'; b=2;a=1; ...

12 mesi fa | 1

| accettato

Risposto
Why does the solution contain the c1 variable even though I set the conditions?
Problem with y(0) condition (log(0) = -inf) syms y(x) ode = diff(y) == 2+y/x; cond = y(.001) == 0; ySol = dsolve(ode,cond) ...

12 mesi fa | 1

Risposto
RK4 Function Code
dydx = @(x,y) 3.*exp(-x)-0.4*y; [x,y] = rk4(dydx,0,100,-0.5,0.5); plot(x,y,'o-'); function [x,y] = rk4(dydx,xo,xf,yo,h...

12 mesi fa | 0

Risposto
How to find equal values/words between two string vectors?
a=["10", "25", "V4E", "64", "33"]; b=["64","V4E", "T2S", "10", "11"]; c=find(ismember(a,b)) d=a(c)

12 mesi fa | 1

| accettato

Risposto
How can I fix this error?
f = @(x)4./(1+x.^2) a = 0; b = 1; F = @(x)-8*x./(1+x.^2).^2 % antiderivative of f ref = F(b) - F(a); n = 2; x = linspace...

12 mesi fa | 0

Risposto
calculate a double integral in a function
f = @(x,y) sin(2*x).*sin(y); Bmn = findBmn(1,2,f) function Bmn = findBmn(m,n,f) a = pi; fun = @(x,y) f(x,y).*sin(n...

12 mesi fa | 0

| accettato

Risposto
For Loop help for function input
r=randi(2,5,4); r(r==2)=5

12 mesi fa | 0

| accettato

Risposto
Convert 8x3 char to string sequence (MATLAB)
val=['011' '010' '001' '000' '000' '001' '010' '011'] val=val' val=val(:)'

12 mesi fa | 0

Risposto
Empty plot returning when I try to graph
[i,j]=meshgrid(1:1000); xtip=i/1000-.1; y=(j-500)/1000; rr=hypot(xtip,y); K=.5605; M=K./(sqrt(2*pi*rr)); plot(rr,M, "--");...

12 mesi fa | 0

Risposto
for k=1:7 data{k}=readmatrix(sprintf('model_%d.xlsx',k));%create cell array assuming the sizes are not the same end

12 mesi fa | 0

| accettato

Risposto
Displaying even numbers in a series
n=1:.5:10; n(mod(n,2)==0)

12 mesi fa | 1

| accettato

Risposto
I would do I calculate the surface area of an abnormal shape?
pgon(i)=polyshape(g(:,1),g(:,2)); plot(pgon(i)); A(i)=area(pgon(i));

12 mesi fa | 0

| accettato

Risposto
How to categorize elements in a matrix based on positive or negative terms and assign them '0' and '1'
A=[ 0.468505878281799 -1.90580778081907 -2.25397431420907 -3.46546394734966 0.488991442582022 -1.68349064240944 0.37733413...

12 mesi fa | 0

| accettato

Risposto
For loop not stopping
Instead of a for-loop, just do it all at once. idx=aspect(:,1)==-9999; aspect(idx,1)=nan;

12 mesi fa | 0

| accettato

Risposto
Select only some coordinates from a .txt file

12 mesi fa | 0

| accettato

Risposto
Rearranging matrix of sth elements
n=1:1716; N=[]; for k=1:66 N=[N,n(k:66:end)]; end

12 mesi fa | 0

| accettato

Risposto
writing binary number with specific length (MATLAB)
n=3; A=0.2; B=[0.7 0.5 0.3 0.1 0.1 0.3 0.5 0.7]; K=dec2bin(B/A,3)

12 mesi fa | 0

| accettato

Risposto
how to use "randi" in specific case?
n=10;%length of matrix l=[10 15 20 25]; m=zeros(length(l),n); r1=randperm(length(l));r2=randperm(n,length(l));r3=randperm(len...

12 mesi fa | 0

Risposto
How do I get the angle between three points input by ginput() in appdesigner?
z=[x,y]; d=diff(z); Angle=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));

12 mesi fa | 0

| accettato

Risposto
how to change decimal point place
I am not sure how your numbers are stored. Are they stored as character arrays or doubles? a='3.261505126953125'; b=[a(1),',',...

12 mesi fa | 0

Risposto
How to randomize points using a GUI
Please accept my previous answer if it was acceptable to you. GUI function GUI() f= figure; axes('Parent',f,'Position',...

12 mesi fa | 0

| accettato

Risposto
How to fill the region formed by four lines?
beta11_um1 = @(delta11) 4.1797+0.396*delta11; beta11_lm1 = @(delta11) 0.4090+0.396*delta11; beta11_up1= @(delta11) 3.8058-0.4...

12 mesi fa | 2

| accettato

Risposto
turning the loop answer into a vector
load data_matrix.mat data=SECTION_L; data(:,1:3)=[]; row=9; cleanup=data([1 2 3 row],:); c=1; for i = 1975:2016 for j...

12 mesi fa | 0

| accettato

Risposto
Create a loop with condition
Does not seem like you need random values, but rather all values between -5 to 5 [x,y]=meshgrid(-5:.001:5);%generates all x0 pa...

12 mesi fa | 1

| accettato

Risposto
I need my array to hit zero before starting next iteration
diff_counts=[20 40 60 80 100]; cases1=zeros(1,10080); starts1=sort(randi(10080,1000,1),'ascend'); for j=1:1000 cases1(star...

12 mesi fa | 0

Risposto
Exact value of a result
residuez requires doubles as input, but p is just the roots of polynomial a which you could use symbolic to produce. a=sym([1, ...

12 mesi fa | 0

Risposto
I need my array to hit zero before starting next iteration
Not sure if I completely understood your question, but break will break out of the for-loop. diff_counts=[20 40 60 80 100]; ca...

12 mesi fa | 0

Risposto
how to calculate for a range of values for different initial conditions
beta=linspace(0,(pi/2),90); m=[1.25, 2, 6, 10]; [B,M]=meshgrid(beta,m); gamma= 1.4; theta=atan(2.*cot(B).*((M.*sin(B)).^2-1)...

12 mesi fa | 0

Risposto
Help writing a function for a gui
Not sure what you want the randomize function to do. f= figure; axes('Parent',f,'Position',[0.05, 0.25, 0.9, 0.7]); x = 0.25;...

12 mesi fa | 0

| accettato

Risposto
Help reduce number of rows by grouping continous data
d=find(diff(yourData)>1); m=[yourData(1),yourData(d(1))]; for k=2:length(d) m(k,:)=[yourData(d(k-1)+1),yourData(d(k))];%ge...

12 mesi fa | 0

| accettato