Answered

Flipped numbers (number pyramid)

n=4; for i=1:n A(i)=str2double(string(sprintf('%d',1:i))); end disp(A)

Flipped numbers (number pyramid)

n=4; for i=1:n A(i)=str2double(string(sprintf('%d',1:i))); end disp(A)

circa 2 anni ago | 0

Answered

anyone can solve code y” + y’ =0 to find general solution

syms y(t) eq=diff(y,2)+diff(y)==0; y(t)=dsolve(eq)

anyone can solve code y” + y’ =0 to find general solution

syms y(t) eq=diff(y,2)+diff(y)==0; y(t)=dsolve(eq)

circa 2 anni ago | 0

Answered

asymptotic magnitude bode plot of fractional order transfer function

The following code should give you what you want: hold off; alpha=0.9;Wcr=2; w1=logspace(-1,log10(Wcr),1000);w2=logspace(log1...

asymptotic magnitude bode plot of fractional order transfer function

The following code should give you what you want: hold off; alpha=0.9;Wcr=2; w1=logspace(-1,log10(Wcr),1000);w2=logspace(log1...

circa 2 anni ago | 0

Answered

Filtering Columns by Contents of Rows

n=2; A(:,(sum(~isnan(A),2)<n).')=[]

Filtering Columns by Contents of Rows

n=2; A(:,(sum(~isnan(A),2)<n).')=[]

circa 2 anni ago | 0

Answered

the function of \n

newline For instance: chr = 'Whose woods these are I think I know.'; chr = [chr newline 'His house is in the village though']...

the function of \n

newline For instance: chr = 'Whose woods these are I think I know.'; chr = [chr newline 'His house is in the village though']...

circa 2 anni ago | 2

| accepted

Answered

How do I give order or number for "a" with ijk in the following code ? Please help me

What you are trying to do is not recommended in MATLAB since dynamically creating variables is not useful. You have several othe...

How do I give order or number for "a" with ijk in the following code ? Please help me

What you are trying to do is not recommended in MATLAB since dynamically creating variables is not useful. You have several othe...

circa 2 anni ago | 0

| accepted

Answered

If i try to write derivative of f in the below code(i pointed here), it doesn't work. why?

You do not have to use Symbolic approach this time. Try the following code: hold off; x1=2.5; f=@(x) x.*sqrt(x)+2*x.^3+1.5; %...

If i try to write derivative of f in the below code(i pointed here), it doesn't work. why?

You do not have to use Symbolic approach this time. Try the following code: hold off; x1=2.5; f=@(x) x.*sqrt(x)+2*x.^3+1.5; %...

circa 2 anni ago | 0

Answered

Vectorize for loop with recursion

P1(P4>0)=x; P2(P4<0)=x; P3=P1+P2; P4(2:end)=P3+P4(1:end-1);

Vectorize for loop with recursion

P1(P4>0)=x; P2(P4<0)=x; P3=P1+P2; P4(2:end)=P3+P4(1:end-1);

circa 2 anni ago | 0

Answered

How to create a clickable timeline using app designer, with play/pause button?

If I understood it correctly, you want to dynamically change the time limits of an axes property. The attached app may be a star...

How to create a clickable timeline using app designer, with play/pause button?

If I understood it correctly, you want to dynamically change the time limits of an axes property. The attached app may be a star...

circa 2 anni ago | 0

Answered

How to replace equations in symbolic function

By using subs function: syms a b x F=3*a*b; Fnew=subs(F,{a,b},{x,1})

How to replace equations in symbolic function

By using subs function: syms a b x F=3*a*b; Fnew=subs(F,{a,b},{x,1})

circa 2 anni ago | 0

| accepted

Answered

problem with function sinc

Adapt its formula as follows: x = 0:pi/100:2*pi; y=sin(pi*x)./(pi*x);%sinc function plot(y)

problem with function sinc

Adapt its formula as follows: x = 0:pi/100:2*pi; y=sin(pi*x)./(pi*x);%sinc function plot(y)

circa 2 anni ago | 2

| accepted

Answered

repeat an element in a vector

[n(1) n] or [repmat(n(1),1) n]

repeat an element in a vector

[n(1) n] or [repmat(n(1),1) n]

circa 2 anni ago | 0

| accepted

Answered

Plotting from a for loop- discrete maps

function [x] = logistic(lambda,x0,n) x(1) = x0; for i= 1:n x(i+1) = lambda*x(i)*(1-x(i)); z(i,:) = [i,x(i)]; di...

Plotting from a for loop- discrete maps

function [x] = logistic(lambda,x0,n) x(1) = x0; for i= 1:n x(i+1) = lambda*x(i)*(1-x(i)); z(i,:) = [i,x(i)]; di...

circa 2 anni ago | 0

| accepted

Answered

Aiming to solve function and have one of the variables be a minimum value:

The key point here is to define solx as a function of r. Try the following code: syms r x a = 100; Cp = .70; b = .50206; c ...

Aiming to solve function and have one of the variables be a minimum value:

The key point here is to define solx as a function of r. Try the following code: syms r x a = 100; Cp = .70; b = .50206; c ...

circa 2 anni ago | 0

| accepted

Answered

How to create this fucntion below

You can try the Symbolic approach: syms y(t) y(t)=piecewise(t<-1,0,t>=-1 & t<0,2,t>=0 & t<=1,-2,t>1,0); %plotting t=-5:0.001...

How to create this fucntion below

You can try the Symbolic approach: syms y(t) y(t)=piecewise(t<-1,0,t>=-1 & t<0,2,t>=0 & t<=1,-2,t>1,0); %plotting t=-5:0.001...

circa 2 anni ago | 0

| accepted

Answered

Can I input an m file into a simulink model as a function block? If so, how?

Use MATLAB Function block.

Can I input an m file into a simulink model as a function block? If so, how?

Use MATLAB Function block.

circa 2 anni ago | 1

Answered

Force Simulink Embedded Coder to do a simple cast when converting float to uint16?

Why don't you use a MATLAB Function block and write this line inside it? For example: y=uint16(x); This line should go inside ...

Force Simulink Embedded Coder to do a simple cast when converting float to uint16?

Why don't you use a MATLAB Function block and write this line inside it? For example: y=uint16(x); This line should go inside ...

circa 2 anni ago | 0

Answered

plotting Intensity function which consists of an exponential sum

Try this: L=100; N=20; d=1; k=10; Ar=1; A=0.1; theta=linspace(-pi/2,pi/2,200); epsilon=rand; phase=(d+A*epsilon)*sin(theta)...

plotting Intensity function which consists of an exponential sum

Try this: L=100; N=20; d=1; k=10; Ar=1; A=0.1; theta=linspace(-pi/2,pi/2,200); epsilon=rand; phase=(d+A*epsilon)*sin(theta)...

circa 2 anni ago | 0

Answered

problem to write a condition for 'if'

Try the following code: A = {[1,2,3,4], [1,2,3,6], [1,2,3,8], [1,2,6,7,8], [1,6,8], [2,3,4,7], [3,4,6], [3,4,6,7], [3,4,6,7,8],...

problem to write a condition for 'if'

Try the following code: A = {[1,2,3,4], [1,2,3,6], [1,2,3,8], [1,2,6,7,8], [1,6,8], [2,3,4,7], [3,4,6], [3,4,6,7], [3,4,6,7,8],...

circa 2 anni ago | 0

| accepted

Answered

control system bode plot

Try this: alpha=1;Wcr=10; syms w Mag(w)=piecewise(w<Wcr,20,w>=Wcr,-26.144+20*alpha*log(w)); w=logspace(-1,3,1000); semilogx...

control system bode plot

Try this: alpha=1;Wcr=10; syms w Mag(w)=piecewise(w<Wcr,20,w>=Wcr,-26.144+20*alpha*log(w)); w=logspace(-1,3,1000); semilogx...

circa 2 anni ago | 0

| accepted

Answered

How can I set linewidth directly in bode command?

You can try semilogx. See the following code: sys=tf(4,[1 0.5 4]); [mag,phase,wout] = bode(sys); Mag=20*log10(mag(:));Phase=p...

How can I set linewidth directly in bode command?

You can try semilogx. See the following code: sys=tf(4,[1 0.5 4]); [mag,phase,wout] = bode(sys); Mag=20*log10(mag(:));Phase=p...

circa 2 anni ago | 0

Answered

How to create a set of impulse values in a given set of timepoints in simulink

See the attached model. I run a simulation for 10 seconds and I create three impulses which appear at t=1, 3 and 6 respectively ...

How to create a set of impulse values in a given set of timepoints in simulink

See the attached model. I run a simulation for 10 seconds and I create three impulses which appear at t=1, 3 and 6 respectively ...

circa 2 anni ago | 0

| accepted

Answered

Error: Line: 9 Column: 19 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

x=-2:0.1:2; y=exp(x.^2).*cos(20.*x); plot(y,x)

Error: Line: 9 Column: 19 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

x=-2:0.1:2; y=exp(x.^2).*cos(20.*x); plot(y,x)

circa 2 anni ago | 1

| accepted

Answered

How to create initialize block on SIMULINK model corresponding with M-file

You can use Callback Function property of your Simulink model. You can find it in File->Model Properties->Callback Functions. He...

How to create initialize block on SIMULINK model corresponding with M-file

You can use Callback Function property of your Simulink model. You can find it in File->Model Properties->Callback Functions. He...

circa 2 anni ago | 0

Answered

How can I sample n elements from each column of a matrix?

Following approach can be used(using for loop): n=2; for i=1:size(A,2) y(:,i)=randsample(A(:,i),n); end y

How can I sample n elements from each column of a matrix?

Following approach can be used(using for loop): n=2; for i=1:size(A,2) y(:,i)=randsample(A(:,i),n); end y

circa 2 anni ago | 0

Answered

How to swap columns of a matrix??

Simple approach(Consider matrix A): A(:,[1 2 8 9])=A(:,[8 9 1 2])

How to swap columns of a matrix??

Simple approach(Consider matrix A): A(:,[1 2 8 9])=A(:,[8 9 1 2])

circa 2 anni ago | 1

| accepted

Answered

Solving trigonometric equations in MATLAB

Try the following code. It should help you: r1=1;r2=2;r3=3;r4=4;r5=5;%random values x1=100:1:126; syms x2 x3 for i=1:numel(x...

Solving trigonometric equations in MATLAB

Try the following code. It should help you: r1=1;r2=2;r3=3;r4=4;r5=5;%random values x1=100:1:126; syms x2 x3 for i=1:numel(x...

circa 2 anni ago | 0

| accepted

Answered

why matlab always show my equation as matrix dimension

Try this: y = (668.061./x)*[-39-exp(-0.1468*x)]

why matlab always show my equation as matrix dimension

Try this: y = (668.061./x)*[-39-exp(-0.1468*x)]

circa 2 anni ago | 0

Answered

Calculating a new variable from a symbolic equation

You already defined values for Q_full and Q. You do not need to define them as symbolic variables later. This will not work. Try...

Calculating a new variable from a symbolic equation

You already defined values for Q_full and Q. You do not need to define them as symbolic variables later. This will not work. Try...

circa 2 anni ago | 0

| accepted