Answered

Help with while loop

%f true dt = input('Enter the desired time step: '); while dt <= h^2 / (4*alpha) disp('The solution is stable') if dt ...

Help with while loop

%f true dt = input('Enter the desired time step: '); while dt <= h^2 / (4*alpha) disp('The solution is stable') if dt ...

ungefär 5 timmar ago | 0

Answered

graphing data using webread

figure(1) subplot (2,2,z) if z == 1 % plot the data and average plot(x(1:100:end),y(1:100:end),x(1:100:end),avg_y...

graphing data using webread

figure(1) subplot (2,2,z) if z == 1 % plot the data and average plot(x(1:100:end),y(1:100:end),x(1:100:end),avg_y...

ungefär 7 timmar ago | 0

Answered

Create new column in table based on another column value

clear ID = [123 345 234] Occurences = [9 1 3] T = table(ID',Occurences','VariableNames',{'ID','Occurences'}); for i = 1:l...

Create new column in table based on another column value

clear ID = [123 345 234] Occurences = [9 1 3] T = table(ID',Occurences','VariableNames',{'ID','Occurences'}); for i = 1:l...

ungefär 10 timmar ago | 0

Answered

How to know which plot is more linear then the other?

AA = diff(A); % compute the slope BB = diff(B); plot(AA); hold on; plot(BB) % and plot to compare linearity

How to know which plot is more linear then the other?

AA = diff(A); % compute the slope BB = diff(B); plot(AA); hold on; plot(BB) % and plot to compare linearity

ungefär 10 timmar ago | 0

Answered

How do I plot a transient voltage response before and after a switch is thrown?

%if true Vc(t>0) = 4.604 * (1 + exp(-t(t>0)./ tau)); plot(t, Vc); title('Capacitor Voltage vs Time'); xlabel('Time (s)'); ...

How do I plot a transient voltage response before and after a switch is thrown?

%if true Vc(t>0) = 4.604 * (1 + exp(-t(t>0)./ tau)); plot(t, Vc); title('Capacitor Voltage vs Time'); xlabel('Time (s)'); ...

ungefär 12 timmar ago | 1

| accepted

Answered

matrix while using ODE45

Shaft_speed=1; % specify a value instead of vector %shaft speed in rad/s Rad_speed=Shaft_speed*((2*pi)/60); %freq of harmo...

matrix while using ODE45

Shaft_speed=1; % specify a value instead of vector %shaft speed in rad/s Rad_speed=Shaft_speed*((2*pi)/60); %freq of harmo...

ungefär 14 timmar ago | 0

| accepted

Answered

Minor mistake Writing a function but error

%if true f = @(x) (1/x)+(sqrt(x)*exp(x))

Minor mistake Writing a function but error

%if true f = @(x) (1/x)+(sqrt(x)*exp(x))

ungefär 24 timmar ago | 0

Answered

Matrix Operation and decomposition

%f true A=rand(80,80); AA = A.^(-1/2); AAA = A.^(1/2);

Matrix Operation and decomposition

%f true A=rand(80,80); AA = A.^(-1/2); AAA = A.^(1/2);

en dag ago | 0

Answered

Index exceeds the number of array elements

%if true x = 0:h:1;% size has 201 elements Define this according to function calculations e.g. x = 0:1/((N+1)*mm...

Index exceeds the number of array elements

%if true x = 0:h:1;% size has 201 elements Define this according to function calculations e.g. x = 0:1/((N+1)*mm...

en dag ago | 0

| accepted

Answered

Given two arrays a and b how do you implement it to draw a graph with for loop such that the x axis is set of values from a and y axis is the values from b .i.e the graph is the format 'a' vs 'b.......................................................'

clear t = 0:0.1:10; for i = 1:length(t) B(i) = 2*t(i); end [x y] = find(B == max(B)) % finds the row and col indices where...

Given two arrays a and b how do you implement it to draw a graph with for loop such that the x axis is set of values from a and y axis is the values from b .i.e the graph is the format 'a' vs 'b.......................................................'

clear t = 0:0.1:10; for i = 1:length(t) B(i) = 2*t(i); end [x y] = find(B == max(B)) % finds the row and col indices where...

en dag ago | 0

| accepted

Answered

Trying to plot this curve what have I done wrong?

%if true x = 1:10;% define values for x vector plot(18*sqrt(2)*(sqrt(1+1./(1+x.^2))+... asin(1./(1+x.^2)-pi/2)))

Trying to plot this curve what have I done wrong?

%if true x = 1:10;% define values for x vector plot(18*sqrt(2)*(sqrt(1+1./(1+x.^2))+... asin(1./(1+x.^2)-pi/2)))

2 dagar ago | 0

Answered

Plot and scatter plot, weird lines removal

%f true plot(g,f,'+'); Use a marker in the plot function By default plot uses a continous line

Plot and scatter plot, weird lines removal

%f true plot(g,f,'+'); Use a marker in the plot function By default plot uses a continous line

2 dagar ago | 0

| accepted

Answered

How can I create a horizontal bar plot and label in each stack

%if width=0.1 barh(a1,width,'stacked') legend('1','2','3','4','5','6','7','8') To add labels on bar sections read the _...

How can I create a horizontal bar plot and label in each stack

%if width=0.1 barh(a1,width,'stacked') legend('1','2','3','4','5','6','7','8') To add labels on bar sections read the _...

2 dagar ago | 0

Answered

Some problems with “writematrix” function。

%if true T = ["100011";"101000"]; iwant = str2double(T); writematrix(iwant,'your file.txt')

Some problems with “writematrix” function。

%if true T = ["100011";"101000"]; iwant = str2double(T); writematrix(iwant,'your file.txt')

2 dagar ago | 0

Answered

How to add values around a vector without changing the vector values.

%if true Y = 1:21; Y = Y' Y(1,1) = 0; Y(21,1) = 0

How to add values around a vector without changing the vector values.

%if true Y = 1:21; Y = Y' Y(1,1) = 0; Y(21,1) = 0

3 dagar ago | 0

Answered

Directivity function (polar pattern) of acoustic dipole in closed form?

%if true theta = 0:360 polar(sin(theta).^2*pi/180)% sin^2(theta)

Directivity function (polar pattern) of acoustic dipole in closed form?

%if true theta = 0:360 polar(sin(theta).^2*pi/180)% sin^2(theta)

3 dagar ago | 1

| accepted

Answered

P(t)=25sin(35t) euler method

%if true x = zeros(1,2); There is no _xeros_ function im matlab

P(t)=25sin(35t) euler method

%if true x = zeros(1,2); There is no _xeros_ function im matlab

3 dagar ago | 0

Answered

How do I get a loop to calculate for each value of a formula, not just the last n of the input(N)?

%if true for j=1:N You need to use above loop structure. You don't need one for loop

How do I get a loop to calculate for each value of a formula, not just the last n of the input(N)?

%if true for j=1:N You need to use above loop structure. You don't need one for loop

3 dagar ago | 0

Answered

Import data doesn't import some of the values

T = readtable('weighted_network.txt') % you can also use readmatrix function

Import data doesn't import some of the values

T = readtable('weighted_network.txt') % you can also use readmatrix function

3 dagar ago | 0

Answered

Create a histogram of y-axis positions at x=100?

hold on Y = 1:30; X = 1:100; bar(X(end),Y*0.1,'stacked'); % scaled to represent bar with plot You can use the above at the ...

Create a histogram of y-axis positions at x=100?

hold on Y = 1:30; X = 1:100; bar(X(end),Y*0.1,'stacked'); % scaled to represent bar with plot You can use the above at the ...

3 dagar ago | 0

Answered

how to change x and y values to a range of values

X=linspace(-2*c,1*c,20); % define X vector similar to Y but of same number of divisions i.e. 20 Y=linspace(-.7*c,0.1*c,20); %...

how to change x and y values to a range of values

X=linspace(-2*c,1*c,20); % define X vector similar to Y but of same number of divisions i.e. 20 Y=linspace(-.7*c,0.1*c,20); %...

4 dagar ago | 0

Answered

How to plot level curves

[X,Y] = meshgrid(700:1:900,-100:1:100); % assumed in nano and micro meters Z = exp(-0.5.*((X-800)./40).^2)*cos((2*pi.*Y*1000...

How to plot level curves

[X,Y] = meshgrid(700:1:900,-100:1:100); % assumed in nano and micro meters Z = exp(-0.5.*((X-800)./40).^2)*cos((2*pi.*Y*1000...

4 dagar ago | 0

Answered

Error plot is starting at the wrong value in my "while loop"

while t1<6 theta1(i+1)=theta1(i)+psy1(i)*dt1 psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i); theta_exact(i)=1...

Error plot is starting at the wrong value in my "while loop"

while t1<6 theta1(i+1)=theta1(i)+psy1(i)*dt1 psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i); theta_exact(i)=1...

4 dagar ago | 0

Answered

Function keeps getting errors, how to fix?

function RH = RelHum(Tdb, Twb) syms n % define the symbolic n ftoc = @(n) ((n-32)*(5/9)); svp = exp(1)^((16.78*ftoc(Tdb) ...

Function keeps getting errors, how to fix?

function RH = RelHum(Tdb, Twb) syms n % define the symbolic n ftoc = @(n) ((n-32)*(5/9)); svp = exp(1)^((16.78*ftoc(Tdb) ...

4 dagar ago | 1

| accepted

Answered

How do I fix this error to output the correct data? I get an error when I use disp.

disp(['You caught ', wholeFishWeight , ' kg of fish for Whole Fish, to be sold for $' , wholeFishIncome]) disp(['You caught ' ,...

How do I fix this error to output the correct data? I get an error when I use disp.

disp(['You caught ', wholeFishWeight , ' kg of fish for Whole Fish, to be sold for $' , wholeFishIncome]) disp(['You caught ' ,...

4 dagar ago | 0

Answered

Create two x axes, but one of them is a log scale

Read semilogx function https://in.mathworks.com/help/matlab/ref/semilogx.html

Create two x axes, but one of them is a log scale

Read semilogx function https://in.mathworks.com/help/matlab/ref/semilogx.html

4 dagar ago | 0

Answered

I have complex output values, but the output displays the 0 of the other half as well

M= [ 0+9i 0+1i ; 0+1i 67+19i] disp(table(imag(M),'VariableNames',{'Impedence Matrix'})) %Imp = table(real...

I have complex output values, but the output displays the 0 of the other half as well

M= [ 0+9i 0+1i ; 0+1i 67+19i] disp(table(imag(M),'VariableNames',{'Impedence Matrix'})) %Imp = table(real...

5 dagar ago | 0

Answered

Composite Simpson's 1/3 rule code error

syms x % define x as symbol %x = linspace(0, 4,5); fx=@(x) 1-exp(-x); % use function handle as D'Errico suggested Then you ...

Composite Simpson's 1/3 rule code error

syms x % define x as symbol %x = linspace(0, 4,5); fx=@(x) 1-exp(-x); % use function handle as D'Errico suggested Then you ...

5 dagar ago | 0

Answered

Changing variables within loop equations

L = 1:21; % use a vector for iteration /counter for i = 1:1:L(8) % access them via L ... % your code end for i = L(9):1:...

Changing variables within loop equations

L = 1:21; % use a vector for iteration /counter for i = 1:1:L(8) % access them via L ... % your code end for i = L(9):1:...

5 dagar ago | 0

| accepted

Answered

How to extract specific values in some pattern from rows and columns of a table?...(in this case somewhat zig zag)

see this solution shown in below link https://in.mathworks.com/matlabcentral/answers/373937-how-to-find-pattern-in-an-array

How to extract specific values in some pattern from rows and columns of a table?...(in this case somewhat zig zag)

see this solution shown in below link https://in.mathworks.com/matlabcentral/answers/373937-how-to-find-pattern-in-an-array

5 dagar ago | 0