Answered

strength of materials in matlab

P = [0 0] ; L = 1000 ; % length of beam B = 0.5 ; % breadth of beam B = [P ; L P(2) ; L B ; P(1) B] ; patch(B(:...

strength of materials in matlab

P = [0 0] ; L = 1000 ; % length of beam B = 0.5 ; % breadth of beam B = [P ; L P(2) ; L B ; P(1) B] ; patch(B(:...

7 dagar ago | 0

Answered

How to make a contour plot with data from using ode45

X= linspace(1,5,5); % Vector for alpha_p values Y= linspace(0.5,3,5); % Vector for beta_p values [A, B]= meshgrid(X,Y); nt ...

How to make a contour plot with data from using ode45

X= linspace(1,5,5); % Vector for alpha_p values Y= linspace(0.5,3,5); % Vector for beta_p values [A, B]= meshgrid(X,Y); nt ...

7 dagar ago | 0

Answered

Find the general solution of the equation y ′ − y = y 2 e x .

syms y(x) ode = diff(y,x)-y==y^2*exp(x) ; sol = dsolve(ode)

Find the general solution of the equation y ′ − y = y 2 e x .

syms y(x) ode = diff(y,x)-y==y^2*exp(x) ; sol = dsolve(ode)

9 dagar ago | 0

Answered

Let A and B be square matrices of same order. Prove that characteristic polynomials of AB and BA are same. Do AB and BA have same minimal polynomial ?

Calculate the eigenvalues of the product. They will be euqal. A = rand(2) ; B = rand(2) ; AB = eig(A*B) BA = eig(B*A)

Let A and B be square matrices of same order. Prove that characteristic polynomials of AB and BA are same. Do AB and BA have same minimal polynomial ?

Calculate the eigenvalues of the product. They will be euqal. A = rand(2) ; B = rand(2) ; AB = eig(A*B) BA = eig(B*A)

9 dagar ago | 0

Answered

if(0.41 == (41*0.01)) is False and if(0.42 == (42*0.01)) is True .. Why?

Read about comparing floating-point numbers. tol = 10^-5 ; if(abs(0.41-(41*0.01)<=tol)) %First Condition disp('tr...

if(0.41 == (41*0.01)) is False and if(0.42 == (42*0.01)) is True .. Why?

Read about comparing floating-point numbers. tol = 10^-5 ; if(abs(0.41-(41*0.01)<=tol)) %First Condition disp('tr...

9 dagar ago | 0

| accepted

Answered

Error: Brace indexing is not supported for variables of this type.

datevec = cell2mat(datenum); Or check class(datenum) It should be already a converted to double.

Error: Brace indexing is not supported for variables of this type.

datevec = cell2mat(datenum); Or check class(datenum) It should be already a converted to double.

9 dagar ago | 0

| accepted

Answered

Sum of two numbers is not accepted

Read about comparing two floating-point numbers. a=0.14+0.001; tol = 10^-5 ; idx = abs(M(:,2)-a)<=tol ; M(idx,:)=[];

Sum of two numbers is not accepted

Read about comparing two floating-point numbers. a=0.14+0.001; tol = 10^-5 ; idx = abs(M(:,2)-a)<=tol ; M(idx,:)=[];

9 dagar ago | 0

| accepted

Answered

How to remove the grid from plot

x = linspace(0,10); [X,Y] = meshgrid(x,x); z = X.*Y; pcolor(x,x,z); shading interp

How to remove the grid from plot

x = linspace(0,10); [X,Y] = meshgrid(x,x); z = X.*Y; pcolor(x,x,z); shading interp

9 dagar ago | 1

| accepted

Answered

Matrix dimensions must agree error

Ws=2*pi*60; tetha=0; t=0:0.0001:0.1; v1=linspace(1,30,length(t)); % it can be v1=1:1:30 N=45; I=10; p=2; K =(2*N*I)/(pi*...

Matrix dimensions must agree error

Ws=2*pi*60; tetha=0; t=0:0.0001:0.1; v1=linspace(1,30,length(t)); % it can be v1=1:1:30 N=45; I=10; p=2; K =(2*N*I)/(pi*...

9 dagar ago | 0

| accepted

Answered

How can I plot a unit vector in 3-D space?

You need not to use that complex, time consuming loop to get what you want. clear all close all clc N=101; x=linspace(-10,...

How can I plot a unit vector in 3-D space?

You need not to use that complex, time consuming loop to get what you want. clear all close all clc N=101; x=linspace(-10,...

9 dagar ago | 0

| accepted

Answered

mean over over multiple dimensions and multiple arrays

% make dummy data N = 8 ; for i = 1:N C{i} = rand(2,2,3) ; end % get the mean N = length(C) ; [m,n,p] = size(C{1})...

mean over over multiple dimensions and multiple arrays

% make dummy data N = 8 ; for i = 1:N C{i} = rand(2,2,3) ; end % get the mean N = length(C) ; [m,n,p] = size(C{1})...

9 dagar ago | 1

| accepted

Answered

How to extract a 1D dose at certain depth in x,y or z-direction from a 3D array?

I feel slice is your function.... load("xdim.mat") ; load("ydim.mat") ; load("zdim.mat") ; load("3d_dose data.mat") ; ...

How to extract a 1D dose at certain depth in x,y or z-direction from a 3D array?

I feel slice is your function.... load("xdim.mat") ; load("ydim.mat") ; load("zdim.mat") ; load("3d_dose data.mat") ; ...

10 dagar ago | 0

Answered

Sum of elements in cell array

Better use loop to avoid confusion using cellfun. Note cellfun also use loop inside. clc; clear all ; load("numerical.mat"); ...

Sum of elements in cell array

Better use loop to avoid confusion using cellfun. Note cellfun also use loop inside. clc; clear all ; load("numerical.mat"); ...

10 dagar ago | 0

Answered

3D plot on 3D matrix

You can use pcolor/ surf. You can plot w.r.t indices. val = rand(10,5,2) ; % using pcolor subplot(211) pcolor(val(:,:,1))...

3D plot on 3D matrix

You can use pcolor/ surf. You can plot w.r.t indices. val = rand(10,5,2) ; % using pcolor subplot(211) pcolor(val(:,:,1))...

10 dagar ago | 0

Answered

How to find the point at which a line becomes perpendicular to another line?

x = [150 0] y = [0 150] C = [0 0] ; % get the line ax+by+c = 0 slope = diff(y)/diff(x) ; % slope a = slope ; b = -1...

How to find the point at which a line becomes perpendicular to another line?

x = [150 0] y = [0 150] C = [0 0] ; % get the line ax+by+c = 0 slope = diff(y)/diff(x) ; % slope a = slope ; b = -1...

10 dagar ago | 0

| accepted

Answered

Inserting a row in a matrix in a precise place

A = [ 2 8 3 11 ; 13 33 4 5 ; 18 8 4 7 ; 23 4 6 11 ] ; b = [ 8 4 23 9 ] ; idx = find(A(:,1)<b(1))+1 ; % get the positon whe...

Inserting a row in a matrix in a precise place

A = [ 2 8 3 11 ; 13 33 4 5 ; 18 8 4 7 ; 23 4 6 11 ] ; b = [ 8 4 23 9 ] ; idx = find(A(:,1)<b(1))+1 ; % get the positon whe...

10 dagar ago | 0

Answered

Trying to get all results from a for loop into an array

clc clear close all format long G % Given variables xpos = 4.000; % Initial x position ypos = 0.000; ...

Trying to get all results from a for loop into an array

clc clear close all format long G % Given variables xpos = 4.000; % Initial x position ypos = 0.000; ...

10 dagar ago | 0

Answered

How do I put red dots on the original image?

You can use holdon and the use plot. You can use MarketSize and MarkerShape etc....many other options are there.

How do I put red dots on the original image?

You can use holdon and the use plot. You can use MarketSize and MarkerShape etc....many other options are there.

10 dagar ago | 0

Answered

How to read a hexadecimal numbers and flip

str = "00 00 00 02 78 0B 09 00 DA 7F" ; str = fliplr(strsplit(str)) ; iwant = strjoin(str) ;

How to read a hexadecimal numbers and flip

str = "00 00 00 02 78 0B 09 00 DA 7F" ; str = fliplr(strsplit(str)) ; iwant = strjoin(str) ;

10 dagar ago | 1

Answered

Magnetic Field Given Bx, By,Bz and Given XYZ of Spacecraft

You can use quiver3. Read about it. https://in.mathworks.com/help/matlab/ref/quiver3.html

Magnetic Field Given Bx, By,Bz and Given XYZ of Spacecraft

You can use quiver3. Read about it. https://in.mathworks.com/help/matlab/ref/quiver3.html

10 dagar ago | 0

Answered

Retrieve original index from a masked array

Repalce the other elements in A with NaN other than mask. B = A ; B(~m) = NaN ; [~,i] = min(B); % now the index will be of...

Retrieve original index from a masked array

Repalce the other elements in A with NaN other than mask. B = A ; B(~m) = NaN ; [~,i] = min(B); % now the index will be of...

11 dagar ago | 1

| accepted

Answered

loop for sum and average for specific rows

A = rand(300,1) ; B = reshape(A,12,[]) ; thesum = sum(B,2) ; themean = mean(B,2) ;

loop for sum and average for specific rows

A = rand(300,1) ; B = reshape(A,12,[]) ; thesum = sum(B,2) ; themean = mean(B,2) ;

11 dagar ago | 0

| accepted

Answered

Splitting a matrix into addition of two same size Matrices

x3 = rand(12) ; A = rand ; B = rand ; C = rand ; P = A*x3.^2+B*x3+C ; If A, B, C are matrices x3 = rand(12) ; A = ...

Splitting a matrix into addition of two same size Matrices

x3 = rand(12) ; A = rand ; B = rand ; C = rand ; P = A*x3.^2+B*x3+C ; If A, B, C are matrices x3 = rand(12) ; A = ...

11 dagar ago | 0

Answered

How to use one function in another function

Easy save all the functions in same folder and run. function val = TwoSum(a,b) val = a+b; end function val = ThreeSum...

How to use one function in another function

Easy save all the functions in same folder and run. function val = TwoSum(a,b) val = a+b; end function val = ThreeSum...

11 dagar ago | 0

Answered

Sorting an array and their corresponding

[val,idx] =sort(a) ; iwant = b(idx) ;

Sorting an array and their corresponding

[val,idx] =sort(a) ; iwant = b(idx) ;

11 dagar ago | 0

| accepted

Answered

How can I extract column names from xls sheet and make them workspace variables?

Time = Mockdata.Time ; Depth = Mockdata.Depth ;

How can I extract column names from xls sheet and make them workspace variables?

Time = Mockdata.Time ; Depth = Mockdata.Depth ;

11 dagar ago | 0

| accepted

Answered

Code to read files from ansys fluent and perform calculations

Read about textscan. fid = fopen('Myfile.txt','r') ; S = textscan(fid,'%f %f\n','HeaderLines',4) ; S = S{1} ; fclose(fid...

Code to read files from ansys fluent and perform calculations

Read about textscan. fid = fopen('Myfile.txt','r') ; S = textscan(fid,'%f %f\n','HeaderLines',4) ; S = S{1} ; fclose(fid...

11 dagar ago | 0

Answered

Find out how long after division will be an integer?

if mod(x,1)==0 then x is an whole number/ integer.

Find out how long after division will be an integer?

if mod(x,1)==0 then x is an whole number/ integer.

11 dagar ago | 0