Programming in MATLAB applied to interdisciplinary engineering fields

Answered

Plotting zero vectors in quiver3

Vz=zeros(size(X)); % Ex 2 Vz from worksheet quiver3(X, Y, Z, Vx, Vy, Vz)

Plotting zero vectors in quiver3

Vz=zeros(size(X)); % Ex 2 Vz from worksheet quiver3(X, Y, Z, Vx, Vy, Vz)

3 hours ago | 0

Answered

How to add greek symbols in plot text

plot(exp(2:8)) gtext('y = e^{\alpha.x}')

How to add greek symbols in plot text

plot(exp(2:8)) gtext('y = e^{\alpha.x}')

3 hours ago | 0

Answered

Matrix Dimensions must agree GUI

t= ((vfy-viy)/ay); % t2 = 0 : abs(t)/100 : abs(t)*2; % since starting value of vector t2 is 0 and incrementing forward

Matrix Dimensions must agree GUI

t= ((vfy-viy)/ay); % t2 = 0 : abs(t)/100 : abs(t)*2; % since starting value of vector t2 is 0 and incrementing forward

8 hours ago | 0

Answered

What does [3, Inf] represents?

sizeA is varable with two element vector , 3 and Inf (infinite) It is NOT a matrix with 3 rows and infinite columns

What does [3, Inf] represents?

sizeA is varable with two element vector , 3 and Inf (infinite) It is NOT a matrix with 3 rows and infinite columns

9 hours ago | 0

Answered

For loop stores all zeros then the actual values of last iteration

finalsm(k,:) = soilm; Use the counter k as row index

For loop stores all zeros then the actual values of last iteration

finalsm(k,:) = soilm; Use the counter k as row index

9 hours ago | 0

Answered

Error using + Matrix dimensions must agree.

%t = dt*(0:200); %data window COMMENT THIS LINE IN YOUR PROGRAM fi=50; %Frequency test ww=wgn(201,1,-40); size(transpose(ww...

Error using + Matrix dimensions must agree.

%t = dt*(0:200); %data window COMMENT THIS LINE IN YOUR PROGRAM fi=50; %Frequency test ww=wgn(201,1,-40); size(transpose(ww...

10 hours ago | 0

Answered

how to normalize output for plotting

o=A./sum(A) %S=sum(normalizedvector,'all') %l=sum(normalizedvector(f)) %l=normalizedvector(f); polarplot(theta,o,'*'); Norm...

how to normalize output for plotting

o=A./sum(A) %S=sum(normalizedvector,'all') %l=sum(normalizedvector(f)) %l=normalizedvector(f); polarplot(theta,o,'*'); Norm...

10 hours ago | 0

Answered

ERROR Subscript indices must either be real positive integers or logicals.

for j=2:j_max+1 x=v((j-1:j+N0-2)*dt); Use a positive non zero integer subscripts. In your case it is zero

ERROR Subscript indices must either be real positive integers or logicals.

for j=2:j_max+1 x=v((j-1:j+N0-2)*dt); Use a positive non zero integer subscripts. In your case it is zero

10 hours ago | 0

Answered

Change the color of the empty area of uitable

uit = uitable(uifigure,'Data',rand(10,3),'BackgroundColor',[0.85 0.85 1]) See this ref for additional info https://in.mathwor...

Change the color of the empty area of uitable

uit = uitable(uifigure,'Data',rand(10,3),'BackgroundColor',[0.85 0.85 1]) See this ref for additional info https://in.mathwor...

20 hours ago | 0

Answered

Index loop into matrix

triCoord= zeros(10,9); ntri = 10 qTop = zeros(ntri,3); for n=1:ntri qTop(n,:) = [mean(triCoord(n,[1 4 7])),mean(triCoord(n...

Index loop into matrix

triCoord= zeros(10,9); ntri = 10 qTop = zeros(ntri,3); for n=1:ntri qTop(n,:) = [mean(triCoord(n,[1 4 7])),mean(triCoord(n...

20 hours ago | 0

| accepted

Answered

How can I plot graphs of the following variables?

%Program to solve the Euler equations clear all; clc; %Time Step h = 0.01; %Key Parameters mb = 100; %Mass of Quarter ...

How can I plot graphs of the following variables?

%Program to solve the Euler equations clear all; clc; %Time Step h = 0.01; %Key Parameters mb = 100; %Mass of Quarter ...

20 hours ago | 0

| accepted

Answered

define an equation on Matlab

yy = @(t) y(t)+y(t-1)+y(t-2)-u(t-1)-u(t-2)-e(t) == 0

define an equation on Matlab

yy = @(t) y(t)+y(t-1)+y(t-2)-u(t-1)-u(t-2)-e(t) == 0

21 hours ago | 0

Answered

Index exceeds the number of array elements (0).

%true prompt= 'Enter theta1 value'; A = input(prompt); prompt = 'Enter phi1 value'; B = input(prompt); prompt= 'Enter ...

Index exceeds the number of array elements (0).

%true prompt= 'Enter theta1 value'; A = input(prompt); prompt = 'Enter phi1 value'; B = input(prompt); prompt= 'Enter ...

22 hours ago | 0

| accepted

Answered

Pie chart help grouping

<https://in.mathworks.com/help/matlab/ref/pie.html> Use the above resource

Pie chart help grouping

<https://in.mathworks.com/help/matlab/ref/pie.html> Use the above resource

22 hours ago | 0

Answered

User Defined Functions calling

>>try6 x = 0.10 f(x) = 12.3200 x = 0.20 f(x) = 12.6800 x = 0.30 f(x) = 13.0800 x = 0.40 f(x) = 13.5200 x = 0.50...

User Defined Functions calling

>>try6 x = 0.10 f(x) = 12.3200 x = 0.20 f(x) = 12.6800 x = 0.30 f(x) = 13.0800 x = 0.40 f(x) = 13.5200 x = 0.50...

1 day ago | 0

Answered

Adding shade to specific parts of contour plots

contour(X,Y,Z) hold on patch(X,Y,C) % define the regions with definite colors you want, i.e. gray, white Use only contour a...

Adding shade to specific parts of contour plots

contour(X,Y,Z) hold on patch(X,Y,C) % define the regions with definite colors you want, i.e. gray, white Use only contour a...

1 day ago | 0

Answered

Getting the right colorbar to show in plot

h1 = plot3(Evlon,Evlat,-Evdep,'o'); hold on h2 = plot3(Stalon,Stalat,-Stadep,'rv'); grid on hold on for i=1:length(Evlon) ...

Getting the right colorbar to show in plot

h1 = plot3(Evlon,Evlat,-Evdep,'o'); hold on h2 = plot3(Stalon,Stalat,-Stadep,'rv'); grid on hold on for i=1:length(Evlon) ...

1 day ago | 0

Answered

Plot multiple surfaces on same plot with different color for each surface

h1 = subplot(311) surf(peaks) colormap(h1,spring) shading interp colorbar h2 = subplot(312) surf(peaks) colormap(h2,winte...

Plot multiple surfaces on same plot with different color for each surface

h1 = subplot(311) surf(peaks) colormap(h1,spring) shading interp colorbar h2 = subplot(312) surf(peaks) colormap(h2,winte...

1 day ago | 0

Answered

Color from surf and colorbar doesn't match

surf(x,y,z) shading interp use shading interp for the surf plot

Color from surf and colorbar doesn't match

surf(x,y,z) shading interp use shading interp for the surf plot

1 day ago | 0

Answered

to obtain contour plots

hold on; [m,n]=meshgrid(-500:500,-500:500); p=(((m+299).^2)/5814.25+((n.^2)/2517.2)); contour(m,n,p,10); hold on %%%%%...

to obtain contour plots

hold on; [m,n]=meshgrid(-500:500,-500:500); p=(((m+299).^2)/5814.25+((n.^2)/2517.2)); contour(m,n,p,10); hold on %%%%%...

1 day ago | 0

Answered

How can I save only the values that work?

w = [40+wstep:wstep:50]; k2 = [1:1:100000]; for i = 1:length(m2) X =@(w,k2) abs(((k2-m2(i).*w.^2).*F0)./((k1+k2-m...

How can I save only the values that work?

w = [40+wstep:wstep:50]; k2 = [1:1:100000]; for i = 1:length(m2) X =@(w,k2) abs(((k2-m2(i).*w.^2).*F0)./((k1+k2-m...

1 day ago | 0

| accepted

Answered

Dashed lines showing up Solid

plot(TDCases1(:,1), f_TD,'--k') hold on % use hold on between two plots [sortedDS, sortIds] = sort(DSCases1(:,1)); plot...

Dashed lines showing up Solid

plot(TDCases1(:,1), f_TD,'--k') hold on % use hold on between two plots [sortedDS, sortIds] = sort(DSCases1(:,1)); plot...

1 day ago | 0

Solved

Flip the vector from right to left

Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

1 day ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

1 day ago

Solved

Vector creation

Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

1 day ago

Answered

creating several bar charts with standard deviation

clear xmean = rand(1,4)*3 xstd = rand(1,4) ymean = rand(1,4)*4 ystd = rand(1,4)*0.7 % in one figure subplot(1...

creating several bar charts with standard deviation

clear xmean = rand(1,4)*3 xstd = rand(1,4) ymean = rand(1,4)*4 ystd = rand(1,4)*0.7 % in one figure subplot(1...

1 day ago | 0

Answered

Why matlab reading data from csv file completely different ?

The data in 2nd column of your csv file is treated as text since it was not pasted to excel file correctly, See the attached fi...

Why matlab reading data from csv file completely different ?

The data in 2nd column of your csv file is treated as text since it was not pasted to excel file correctly, See the attached fi...

2 days ago | 2

| accepted