Answered

Capitalize only the first letter of a character

Likely a better way. a='my name'; a(1)=upper(a(1));

Capitalize only the first letter of a character

Likely a better way. a='my name'; a(1)=upper(a(1));

ungefär 3 timmar ago | 0

| accepted

Answered

How do i build a matrix asking the user for inputs?

If allowed, I would build the entire matrix with one input. yourMatrix=input('Input your matrix in the given format, for exampl...

How do i build a matrix asking the user for inputs?

If allowed, I would build the entire matrix with one input. yourMatrix=input('Input your matrix in the given format, for exampl...

4 dagar ago | 0

Answered

How can do this?

c=1; while 1 n(c)=input('Enter positive number'); if n(c)<0 n=n(1:end-1); break; end c=c+1; end fpr...

How can do this?

c=1; while 1 n(c)=input('Enter positive number'); if n(c)<0 n=n(1:end-1); break; end c=c+1; end fpr...

4 dagar ago | 0

Answered

Multiplication of 2 sets to get all possible outcomes

a = 0:0.01:0.2; b = 0:pi/12:pi; [A,B]=meshgrid(a,sin(b)); C=A.*B; c=unique(C(:)');%if you only want unique outcomes.

Multiplication of 2 sets to get all possible outcomes

a = 0:0.01:0.2; b = 0:pi/12:pi; [A,B]=meshgrid(a,sin(b)); C=A.*B; c=unique(C(:)');%if you only want unique outcomes.

4 dagar ago | 0

| accepted

Answered

How to compute the sum term ?

alpha = 0.6; U(1)=1;%you need to specify U(1) and U(2) U(2)=.5; S=2^(1-alpha)*(U(1)-U(2)); U(3)=(U(2)+S)/2; for n=3:50 ...

How to compute the sum term ?

alpha = 0.6; U(1)=1;%you need to specify U(1) and U(2) U(2)=.5; S=2^(1-alpha)*(U(1)-U(2)); U(3)=(U(2)+S)/2; for n=3:50 ...

4 dagar ago | 0

| accepted

Answered

How can I fix this Infinite While loop?

a = 12; b = 13000; x = .2004/a % Interest payment = 700;%I assume you want a constant payment until the last payment count=...

How can I fix this Infinite While loop?

a = 12; b = 13000; x = .2004/a % Interest payment = 700;%I assume you want a constant payment until the last payment count=...

7 dagar ago | 0

Answered

creating a matrix from 2 vectors and a function loop

[wheel_radius,nozzle_radius]=meshgrid(.12:.02:.3,.002:.001:.01); for k=1:numel(wheel_radius) power_output(k)=waterwheel_ge...

creating a matrix from 2 vectors and a function loop

[wheel_radius,nozzle_radius]=meshgrid(.12:.02:.3,.002:.001:.01); for k=1:numel(wheel_radius) power_output(k)=waterwheel_ge...

7 dagar ago | 0

| accepted

Answered

Could someone explain this straight line function?

It is point-slope form of a line. If the points are a=[x2, y2] and b=[x1, y1], then: m=(a(2)-b(2))/(a(1)-b(1));%slope func =@(...

Could someone explain this straight line function?

It is point-slope form of a line. If the points are a=[x2, y2] and b=[x1, y1], then: m=(a(2)-b(2))/(a(1)-b(1));%slope func =@(...

11 dagar ago | 0

Answered

How can I move the bars in a bar chart?

figure; bar_displacement=.25;%play with this until it is correct bar(x-bar_displacement,y); set(gca,'XTick', x);

How can I move the bars in a bar chart?

figure; bar_displacement=.25;%play with this until it is correct bar(x-bar_displacement,y); set(gca,'XTick', x);

13 dagar ago | 0

Answered

ignore NaN values in loop

CC=[]; for i = 2:16 A = walknov(:,i); A = interpft(A(~isnan(A)), 100); if isempty(A) CC=[CC;nan(1,100)]; ...

ignore NaN values in loop

CC=[]; for i = 2:16 A = walknov(:,i); A = interpft(A(~isnan(A)), 100); if isempty(A) CC=[CC;nan(1,100)]; ...

13 dagar ago | 0

Answered

using for loop plotting problem help me

What are you trying to plot? f= @(x) 3*x.^5+7*sin(x).^2;%I doubt you want sind fd= @(x) 15*x.^4+7*sin(2*x).^2+3*x.^5+7*sin(x)...

using for loop plotting problem help me

What are you trying to plot? f= @(x) 3*x.^5+7*sin(x).^2;%I doubt you want sind fd= @(x) 15*x.^4+7*sin(2*x).^2+3*x.^5+7*sin(x)...

13 dagar ago | 0

Answered

Conditional statements on array.

i=reshape(Input,12,[])'>100; Output=zeros(size(i)); for k=1:size(i,1) if nnz(i(k,:))>0 Output(k,:)=1; end ...

Conditional statements on array.

i=reshape(Input,12,[])'>100; Output=zeros(size(i)); for k=1:size(i,1) if nnz(i(k,:))>0 Output(k,:)=1; end ...

13 dagar ago | 1

Answered

what it does mean?

If the matrix 'index' indexed at (1,1) equals 1, then assign S1 =0 and S2 = 0. if index(1,1)==1 S1=0; S2=1; end

what it does mean?

If the matrix 'index' indexed at (1,1) equals 1, then assign S1 =0 and S2 = 0. if index(1,1)==1 S1=0; S2=1; end

13 dagar ago | 0

Answered

for loop issue not all answer printing out

function T = InterestPayment(P,r) for n=1:10 A(n) = P*((r*(1+r)^n)/((1+r)^n-1)); end T= table ((1:10)',A', 'VariableN...

for loop issue not all answer printing out

function T = InterestPayment(P,r) for n=1:10 A(n) = P*((r*(1+r)^n)/((1+r)^n-1)); end T= table ((1:10)',A', 'VariableN...

14 dagar ago | 0

Answered

How can I find the nonzero values in an cells array?.

Non_ceros=zeros(length(Index)); for i = 1 : length(Index) for j = 1 : length(Index) Non_ceros(i,j) = nnz(In...

How can I find the nonzero values in an cells array?.

Non_ceros=zeros(length(Index)); for i = 1 : length(Index) for j = 1 : length(Index) Non_ceros(i,j) = nnz(In...

14 dagar ago | 0

| accepted

Answered

wanna creat a matrix of unknowns and write some equations with those unknowns and then take the matrix of coefficients

syms a b c d; t=[a b;c d]; coef=[2 3]; eqn=dot(coef,t(1,:));

wanna creat a matrix of unknowns and write some equations with those unknowns and then take the matrix of coefficients

syms a b c d; t=[a b;c d]; coef=[2 3]; eqn=dot(coef,t(1,:));

14 dagar ago | 0

Answered

for loop help - Newton's method

I would avoid symbolic unless you need to. f = [2,-6,-12,20,42,18]; df = polyder(f); tol=1e-10; error=1; x=[-2,4];%initial ...

for loop help - Newton's method

I would avoid symbolic unless you need to. f = [2,-6,-12,20,42,18]; df = polyder(f); tol=1e-10; error=1; x=[-2,4];%initial ...

14 dagar ago | 0

| accepted

Answered

store user input in an array

user_input= zeros(1,10); for i = 1:10 while user_input(i)<=0 user_input(i) = input('Enter positive real number : '); ...

store user input in an array

user_input= zeros(1,10); for i = 1:10 while user_input(i)<=0 user_input(i) = input('Enter positive real number : '); ...

14 dagar ago | 0

Answered

How to convert binary bits of a vector, say m, after rotating it left by 1 bit, into decimal ?

m = [16; 10]; %use column vector a = fi(m, 0, 8, 0); b = bin(bitrol(a, 1)); c = bin2dec(b);

How to convert binary bits of a vector, say m, after rotating it left by 1 bit, into decimal ?

m = [16; 10]; %use column vector a = fi(m, 0, 8, 0); b = bin(bitrol(a, 1)); c = bin2dec(b);

14 dagar ago | 0

| accepted

Answered

Generate random numbers in the second decimal point

x=1.198:0.1:2.198; x=x-(randi(6,size(x))+3)/100;

Generate random numbers in the second decimal point

x=1.198:0.1:2.198; x=x-(randi(6,size(x))+3)/100;

18 dagar ago | 1

| accepted

Answered

How to optimize the calculation of the mean between the elements of A and B efficiently?

C=(A+B)/2;

How to optimize the calculation of the mean between the elements of A and B efficiently?

C=(A+B)/2;

20 dagar ago | 0

| accepted

Answered

DOE points normal distrbution

m=standard_deviation.*randn(1,1000)+mean;%generates an array of 1000 numbers

DOE points normal distrbution

m=standard_deviation.*randn(1,1000)+mean;%generates an array of 1000 numbers

21 dagar ago | 0

Answered

Finding an unknown vector from three known vectors

syms x y z; C=[x,y,z]; A = [125 350 -80]; B = [-115 350 -80]; D = [-15 530 545]; eq1=norm(A-C)==300; eq2=norm(B-C)==300;...

Finding an unknown vector from three known vectors

syms x y z; C=[x,y,z]; A = [125 350 -80]; B = [-115 350 -80]; D = [-15 530 545]; eq1=norm(A-C)==300; eq2=norm(B-C)==300;...

21 dagar ago | 0

| accepted

Answered

Unable to concatenate the table variables 'Var1' and 'Var2', because their types are double and cell.

Why not just readmatrix? What column are you skipping? p = readmatrix('Arrone-pluviometro(36045)-2019-0-24'); p(isnan(p))=9999...

Unable to concatenate the table variables 'Var1' and 'Var2', because their types are double and cell.

Why not just readmatrix? What column are you skipping? p = readmatrix('Arrone-pluviometro(36045)-2019-0-24'); p(isnan(p))=9999...

22 dagar ago | 0

Answered

Integrate definite integral with system of differential equations

Can you just do something like this? function dydt = odefun(t, y, c) dydt(1,:) = 1./(1+t.^2) ; % h(t) h=@(x)1./(1+x.^2); ...

Integrate definite integral with system of differential equations

Can you just do something like this? function dydt = odefun(t, y, c) dydt(1,:) = 1./(1+t.^2) ; % h(t) h=@(x)1./(1+x.^2); ...

22 dagar ago | 0

| accepted

Answered

How can I implement a loop to find the minimum among 5 values

Are you not allowed to use the min() function? function D = myfun(A) D=min([.1 3 5 8 12]./cumprod(A));

How can I implement a loop to find the minimum among 5 values

Are you not allowed to use the min() function? function D = myfun(A) D=min([.1 3 5 8 12]./cumprod(A));

22 dagar ago | 0

Answered

Using fzero on function

y=@(x)x.^6-2.*cos(x); x=linspace(-3,3,100); plot(x,y(x)); z(1)=fzero(y,-1); z(2)=fzero(y,1);

Using fzero on function

y=@(x)x.^6-2.*cos(x); x=linspace(-3,3,100); plot(x,y(x)); z(1)=fzero(y,-1); z(2)=fzero(y,1);

22 dagar ago | 0

| accepted

Answered

How to Define a Symbolic Continued Fraction

function L = continuedFraction(N,n) syms A B; if n==0 L=0; else L=1/(B/(N-1)+A/N+continuedFraction(N,n-1)); end R...

How to Define a Symbolic Continued Fraction

function L = continuedFraction(N,n) syms A B; if n==0 L=0; else L=1/(B/(N-1)+A/N+continuedFraction(N,n-1)); end R...

23 dagar ago | 1