Tag Archives: matlab
i want matlab code to find sand grain size
If sand image is given, how to find sand grain sizeIf sand image is given, how to find sand grain size If sand image is given, how to find sand grain size sand grain size MATLAB Answers — New Questions
Scatter graph trend line adjustment and outlier removal
Hi
I have produced the following plot for my sensor. At times my sensor could produce a false result while its trying to stablise, general all samples should be close to a trendline unlike the samples below. Is there any function which can correct this false samples, while plotting a scatter plot? I am aware of the various outliers functions i can use prior to the plotting of data, but was woundering if it possible while plot the trendline or manual adjust the trendline?Hi
I have produced the following plot for my sensor. At times my sensor could produce a false result while its trying to stablise, general all samples should be close to a trendline unlike the samples below. Is there any function which can correct this false samples, while plotting a scatter plot? I am aware of the various outliers functions i can use prior to the plotting of data, but was woundering if it possible while plot the trendline or manual adjust the trendline? Hi
I have produced the following plot for my sensor. At times my sensor could produce a false result while its trying to stablise, general all samples should be close to a trendline unlike the samples below. Is there any function which can correct this false samples, while plotting a scatter plot? I am aware of the various outliers functions i can use prior to the plotting of data, but was woundering if it possible while plot the trendline or manual adjust the trendline? scatter, matlab MATLAB Answers — New Questions
please fix the error for Index exceeds matrix dimensions.
% Parameters
M = 16; % QAM modulation order
k = log2(M); % Number of bits per symbol
% UFMC system parameters
N = 128; % Number of subcarriers
L = 4; % Number of subcarriers per data block
alpha = 0.5:0.1:1.5; % Roll-off factor range
EbNo = 10; % Energy per bit to noise power spectral density ratio (dB)
% Generate random bits
numBits = N * k; % Total number of bits
data = randi([0 1], numBits, 1); % Random binary data
% Preallocate BER arrays
berKaiser = zeros(size(alpha));
berDolphChebyshev = zeros(size(alpha));
% Perform BER simulation for different roll-off factors
for i = 1:length(alpha)
% QAM modulation
qamData = qammod(data, M);
% UFMC modulation with Kaiser filter
ufmcDataKaiser = ufmcKyModulation(qamData, N, L, alpha(i), ‘kaiser’);
% UFMC modulation with Dolph-Chebyshev filter
ufmcDataDolphChebyshev = ufmcchModulation(qamData, N, L, alpha(i), ‘dolphchebyshev’);
% Add Rayleigh fading channel
h = (randn(128, length(ufmcDataKaiser)) + 1i * randn(128, length(ufmcDataKaiser))) / sqrt(2);
receivedSignalKaiser = ufmcDataKaiser .* h;
receivedSignalDolphChebyshev = ufmcDataDolphChebyshev .* h;
% AWGN channel
snr = EbNo + 10 * log10(k); % Convert EbNo to SNR
receivedSignalKaiser = awgn(receivedSignalKaiser, snr, ‘measured’);
receivedSignalDolphChebyshev = awgn(receivedSignalDolphChebyshev, snr, ‘measured’);
% UFMC demodulation
demodulatedDataKaiser = ufmcKyDemodulation(receivedSignalKaiser, N, L, alpha(i), ‘kaiser’);
demodulatedDataDolphChebyshev = ufmcchDemodulation(receivedSignalDolphChebyshev, N, L, alpha(i), ‘dolphchebyshev’);
% QAM demodulation
receivedBitsKaiser = qamdemod(demodulatedDataKaiser, M);
receivedBitsDolphChebyshev = qamdemod(demodulatedDataDolphChebyshev, M);
% Calculate BER
berKaiser(i) = biterr(data, receivedBitsKaiser) / numBits;
berDolphChebyshev(i) = biterr(data, receivedBitsDolphChebyshev) / numBits;
end
% Plot BER results
figure;
semilogy(alpha, berKaiser, ‘b-o’, ‘LineWidth’, 1.5);
hold on;
semilogy(alpha, berDolphChebyshev, ‘r-s’, ‘LineWidth’, 1.5);
grid on;
xlabel(‘Roll-off Factor (alpha)’);
ylabel(‘Bit Error Rate (BER)’);
title(‘BER Performance Comparison: Kaiser vs. Dolph-Chebyshev Filter (Rayleigh Fading Channel)’);
legend(‘Kaiser Filter’, ‘Dolph-Chebyshev Filter’);% Parameters
M = 16; % QAM modulation order
k = log2(M); % Number of bits per symbol
% UFMC system parameters
N = 128; % Number of subcarriers
L = 4; % Number of subcarriers per data block
alpha = 0.5:0.1:1.5; % Roll-off factor range
EbNo = 10; % Energy per bit to noise power spectral density ratio (dB)
% Generate random bits
numBits = N * k; % Total number of bits
data = randi([0 1], numBits, 1); % Random binary data
% Preallocate BER arrays
berKaiser = zeros(size(alpha));
berDolphChebyshev = zeros(size(alpha));
% Perform BER simulation for different roll-off factors
for i = 1:length(alpha)
% QAM modulation
qamData = qammod(data, M);
% UFMC modulation with Kaiser filter
ufmcDataKaiser = ufmcKyModulation(qamData, N, L, alpha(i), ‘kaiser’);
% UFMC modulation with Dolph-Chebyshev filter
ufmcDataDolphChebyshev = ufmcchModulation(qamData, N, L, alpha(i), ‘dolphchebyshev’);
% Add Rayleigh fading channel
h = (randn(128, length(ufmcDataKaiser)) + 1i * randn(128, length(ufmcDataKaiser))) / sqrt(2);
receivedSignalKaiser = ufmcDataKaiser .* h;
receivedSignalDolphChebyshev = ufmcDataDolphChebyshev .* h;
% AWGN channel
snr = EbNo + 10 * log10(k); % Convert EbNo to SNR
receivedSignalKaiser = awgn(receivedSignalKaiser, snr, ‘measured’);
receivedSignalDolphChebyshev = awgn(receivedSignalDolphChebyshev, snr, ‘measured’);
% UFMC demodulation
demodulatedDataKaiser = ufmcKyDemodulation(receivedSignalKaiser, N, L, alpha(i), ‘kaiser’);
demodulatedDataDolphChebyshev = ufmcchDemodulation(receivedSignalDolphChebyshev, N, L, alpha(i), ‘dolphchebyshev’);
% QAM demodulation
receivedBitsKaiser = qamdemod(demodulatedDataKaiser, M);
receivedBitsDolphChebyshev = qamdemod(demodulatedDataDolphChebyshev, M);
% Calculate BER
berKaiser(i) = biterr(data, receivedBitsKaiser) / numBits;
berDolphChebyshev(i) = biterr(data, receivedBitsDolphChebyshev) / numBits;
end
% Plot BER results
figure;
semilogy(alpha, berKaiser, ‘b-o’, ‘LineWidth’, 1.5);
hold on;
semilogy(alpha, berDolphChebyshev, ‘r-s’, ‘LineWidth’, 1.5);
grid on;
xlabel(‘Roll-off Factor (alpha)’);
ylabel(‘Bit Error Rate (BER)’);
title(‘BER Performance Comparison: Kaiser vs. Dolph-Chebyshev Filter (Rayleigh Fading Channel)’);
legend(‘Kaiser Filter’, ‘Dolph-Chebyshev Filter’); % Parameters
M = 16; % QAM modulation order
k = log2(M); % Number of bits per symbol
% UFMC system parameters
N = 128; % Number of subcarriers
L = 4; % Number of subcarriers per data block
alpha = 0.5:0.1:1.5; % Roll-off factor range
EbNo = 10; % Energy per bit to noise power spectral density ratio (dB)
% Generate random bits
numBits = N * k; % Total number of bits
data = randi([0 1], numBits, 1); % Random binary data
% Preallocate BER arrays
berKaiser = zeros(size(alpha));
berDolphChebyshev = zeros(size(alpha));
% Perform BER simulation for different roll-off factors
for i = 1:length(alpha)
% QAM modulation
qamData = qammod(data, M);
% UFMC modulation with Kaiser filter
ufmcDataKaiser = ufmcKyModulation(qamData, N, L, alpha(i), ‘kaiser’);
% UFMC modulation with Dolph-Chebyshev filter
ufmcDataDolphChebyshev = ufmcchModulation(qamData, N, L, alpha(i), ‘dolphchebyshev’);
% Add Rayleigh fading channel
h = (randn(128, length(ufmcDataKaiser)) + 1i * randn(128, length(ufmcDataKaiser))) / sqrt(2);
receivedSignalKaiser = ufmcDataKaiser .* h;
receivedSignalDolphChebyshev = ufmcDataDolphChebyshev .* h;
% AWGN channel
snr = EbNo + 10 * log10(k); % Convert EbNo to SNR
receivedSignalKaiser = awgn(receivedSignalKaiser, snr, ‘measured’);
receivedSignalDolphChebyshev = awgn(receivedSignalDolphChebyshev, snr, ‘measured’);
% UFMC demodulation
demodulatedDataKaiser = ufmcKyDemodulation(receivedSignalKaiser, N, L, alpha(i), ‘kaiser’);
demodulatedDataDolphChebyshev = ufmcchDemodulation(receivedSignalDolphChebyshev, N, L, alpha(i), ‘dolphchebyshev’);
% QAM demodulation
receivedBitsKaiser = qamdemod(demodulatedDataKaiser, M);
receivedBitsDolphChebyshev = qamdemod(demodulatedDataDolphChebyshev, M);
% Calculate BER
berKaiser(i) = biterr(data, receivedBitsKaiser) / numBits;
berDolphChebyshev(i) = biterr(data, receivedBitsDolphChebyshev) / numBits;
end
% Plot BER results
figure;
semilogy(alpha, berKaiser, ‘b-o’, ‘LineWidth’, 1.5);
hold on;
semilogy(alpha, berDolphChebyshev, ‘r-s’, ‘LineWidth’, 1.5);
grid on;
xlabel(‘Roll-off Factor (alpha)’);
ylabel(‘Bit Error Rate (BER)’);
title(‘BER Performance Comparison: Kaiser vs. Dolph-Chebyshev Filter (Rayleigh Fading Channel)’);
legend(‘Kaiser Filter’, ‘Dolph-Chebyshev Filter’); matlab code MATLAB Answers — New Questions
Perform Successive Approximation Register on a Signal Analog to Digital Converter With Error output
Hello I was working on making a SAR ADC system directly in MATLAB code. As for now im unable to create it since what im doing is quantizicing the data in a way that im actually sampling. Been trying to do an SAR but after many attempts im unsuccesful? Any help for the basic Successive Approximation Register code.Hello I was working on making a SAR ADC system directly in MATLAB code. As for now im unable to create it since what im doing is quantizicing the data in a way that im actually sampling. Been trying to do an SAR but after many attempts im unsuccesful? Any help for the basic Successive Approximation Register code. Hello I was working on making a SAR ADC system directly in MATLAB code. As for now im unable to create it since what im doing is quantizicing the data in a way that im actually sampling. Been trying to do an SAR but after many attempts im unsuccesful? Any help for the basic Successive Approximation Register code. adc, sar, successive approximation register, analog to digital converter MATLAB Answers — New Questions
Optimisation of array to smaller size
I have an array of size 30×20 with non linear breakpoints (Rows & Columns), that I want to convert to a smaller size of 20×15 where the new breakpoints for this smaller array are unknown and require calculating.
I have started by trying to create a linearly spaced array for the new breakpoints, which as an initial guess is ok, however my purpose here is to minimise the error between the larger and smaller arrays. Given that the original arrays breakpoints are non-linear, the assumption that the new array can be linearly spaced, is not ideal and does not minimise the error – My current attempt looks like this;
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
rows = size(app.table_handle.Data, 1);
cols = size(app.table_handle.Data, 2);
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
[col_indices, row_indices] = meshgrid(1:cols, 1:rows);
[new_col_indices, new_row_indices] = meshgrid(linspace(1, cols, new_cols), linspace(1, rows, new_rows));
reduced_map = interp2(col_indices, row_indices, original_map, new_col_indices, new_row_indices, ‘cubic’);
Would it be possible to optimise the breakpoint values to minimise the error between the original array and the new array, then interpolate the original array values to those new breakpoint values? I tried to use fminsearch but ran into problems due to the array sizes not being the same between X & Y breakpoint arrays.
For reference, this is my attempt with using fminsearch;
function error = new_function(new_xbp, new_ybp, original_map, original_xbp, original_ybp)
[X, Y] = meshgrid(new_xbp, new_ybp);
new_map = interp2(original_xbp, original_ybp, original_map, X, Y);
[dxx, dxy, dyy] = gradient2(new_map);
error = sum(sum(dxx.^2 + dxy.^2 + dyy.^2));
end
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
initial_xbp = linspace(original_xbp(1), original_xbp(end), new_cols);
initial_ybp = linspace(original_ybp(1), original_ybp(end), new_rows);
options = optimset(‘Display’, ‘iter’);
[optimal_xbp, ~, ~, output] = fminsearch(@(x) new_function(x, initial_ybp, original_map, original_xbp, original_ybp), initial_xbp, options);
[optimal_ybp, fval] = fminsearch(@(y) new_function(optimal_xbp, y, original_map, original_xbp, original_ybp), initial_ybp, options);
[X, Y] = meshgrid(optimal_xbp, optimal_ybp);
reduced_map = interp2(original_xbp, original_ybp, original_map, X, Y);
Any help is really appreciatted!I have an array of size 30×20 with non linear breakpoints (Rows & Columns), that I want to convert to a smaller size of 20×15 where the new breakpoints for this smaller array are unknown and require calculating.
I have started by trying to create a linearly spaced array for the new breakpoints, which as an initial guess is ok, however my purpose here is to minimise the error between the larger and smaller arrays. Given that the original arrays breakpoints are non-linear, the assumption that the new array can be linearly spaced, is not ideal and does not minimise the error – My current attempt looks like this;
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
rows = size(app.table_handle.Data, 1);
cols = size(app.table_handle.Data, 2);
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
[col_indices, row_indices] = meshgrid(1:cols, 1:rows);
[new_col_indices, new_row_indices] = meshgrid(linspace(1, cols, new_cols), linspace(1, rows, new_rows));
reduced_map = interp2(col_indices, row_indices, original_map, new_col_indices, new_row_indices, ‘cubic’);
Would it be possible to optimise the breakpoint values to minimise the error between the original array and the new array, then interpolate the original array values to those new breakpoint values? I tried to use fminsearch but ran into problems due to the array sizes not being the same between X & Y breakpoint arrays.
For reference, this is my attempt with using fminsearch;
function error = new_function(new_xbp, new_ybp, original_map, original_xbp, original_ybp)
[X, Y] = meshgrid(new_xbp, new_ybp);
new_map = interp2(original_xbp, original_ybp, original_map, X, Y);
[dxx, dxy, dyy] = gradient2(new_map);
error = sum(sum(dxx.^2 + dxy.^2 + dyy.^2));
end
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
initial_xbp = linspace(original_xbp(1), original_xbp(end), new_cols);
initial_ybp = linspace(original_ybp(1), original_ybp(end), new_rows);
options = optimset(‘Display’, ‘iter’);
[optimal_xbp, ~, ~, output] = fminsearch(@(x) new_function(x, initial_ybp, original_map, original_xbp, original_ybp), initial_xbp, options);
[optimal_ybp, fval] = fminsearch(@(y) new_function(optimal_xbp, y, original_map, original_xbp, original_ybp), initial_ybp, options);
[X, Y] = meshgrid(optimal_xbp, optimal_ybp);
reduced_map = interp2(original_xbp, original_ybp, original_map, X, Y);
Any help is really appreciatted! I have an array of size 30×20 with non linear breakpoints (Rows & Columns), that I want to convert to a smaller size of 20×15 where the new breakpoints for this smaller array are unknown and require calculating.
I have started by trying to create a linearly spaced array for the new breakpoints, which as an initial guess is ok, however my purpose here is to minimise the error between the larger and smaller arrays. Given that the original arrays breakpoints are non-linear, the assumption that the new array can be linearly spaced, is not ideal and does not minimise the error – My current attempt looks like this;
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
rows = size(app.table_handle.Data, 1);
cols = size(app.table_handle.Data, 2);
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
[col_indices, row_indices] = meshgrid(1:cols, 1:rows);
[new_col_indices, new_row_indices] = meshgrid(linspace(1, cols, new_cols), linspace(1, rows, new_rows));
reduced_map = interp2(col_indices, row_indices, original_map, new_col_indices, new_row_indices, ‘cubic’);
Would it be possible to optimise the breakpoint values to minimise the error between the original array and the new array, then interpolate the original array values to those new breakpoint values? I tried to use fminsearch but ran into problems due to the array sizes not being the same between X & Y breakpoint arrays.
For reference, this is my attempt with using fminsearch;
function error = new_function(new_xbp, new_ybp, original_map, original_xbp, original_ybp)
[X, Y] = meshgrid(new_xbp, new_ybp);
new_map = interp2(original_xbp, original_ybp, original_map, X, Y);
[dxx, dxy, dyy] = gradient2(new_map);
error = sum(sum(dxx.^2 + dxy.^2 + dyy.^2));
end
original_map = cell2mat(app.table_handle.Data);
original_xbp = str2double(string(app.table_handle.ColumnName));
original_ybp = str2double(string(app.table_handle.RowName));
new_rows = size(app.table2_handle.Data, 1);
new_cols = size(app.table2_handle.Data, 2);
initial_xbp = linspace(original_xbp(1), original_xbp(end), new_cols);
initial_ybp = linspace(original_ybp(1), original_ybp(end), new_rows);
options = optimset(‘Display’, ‘iter’);
[optimal_xbp, ~, ~, output] = fminsearch(@(x) new_function(x, initial_ybp, original_map, original_xbp, original_ybp), initial_xbp, options);
[optimal_ybp, fval] = fminsearch(@(y) new_function(optimal_xbp, y, original_map, original_xbp, original_ybp), initial_ybp, options);
[X, Y] = meshgrid(optimal_xbp, optimal_ybp);
reduced_map = interp2(original_xbp, original_ybp, original_map, X, Y);
Any help is really appreciatted! optimization, interpolation MATLAB Answers — New Questions
Fitting data on equation
Hi, i have an equation (DAR_eq) with 3 parameters (R,a,Cc) that i don’t know and i have to find them. I know that the following sentences might be extremly difficult for you but please at least give it a try. I have a tank with a hole which extrude a given material under a pressure. I’ve made an equation (DAR_eq) to solve this problem but i can’t fit my results on it. My incoming data are "mu" and "DAR"
%DATA of the FLUID (KEPSTAN 6003)
rho=1.27*1000; %density of the fluid Kg/m^3
mu=[1500 1550 1600 1650 1700 1700 1750 1800 1850 1900 1950];%viscosity of the fluid [Pa*s]
DAR=[1.702 2.013 1.391 1.133 1.071 1.024 0.930 0.677 0.631 0.556 0.495];
%MACHINE DATA
m =10; %mass in kg of the weights placed on the piston
D1 =0.02; %tank diameter
D2 =0.0005; %exit hole diameter
A1 =pi*(D1/2)^2; %tank surface
A2 =pi*(D2/2)^2; %surface exit hole
%GIVEN DATA
Ppbar=[145 155 170 195 220 220 235 260 300 350 480]; %pressure in bar
Pp=Ppbar*10000;%pressure in Pa
freq=143;%frequency
FH=(Cc/(g*A2^2));
Qa=FH+a*(rho/2)*(1/(A2^2)-1/(A1^2)); %Qa is the first coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qb=R*mu; %Qb is the second coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qc=-Pp; %Qc is the third coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Delta=(Qb.^2)-4*Qa*Qc;
%EQUATIONS
Flux =(-Qb+sqrt(Delta))/(2*Qa);
DAR_eq=Flux/freq;Hi, i have an equation (DAR_eq) with 3 parameters (R,a,Cc) that i don’t know and i have to find them. I know that the following sentences might be extremly difficult for you but please at least give it a try. I have a tank with a hole which extrude a given material under a pressure. I’ve made an equation (DAR_eq) to solve this problem but i can’t fit my results on it. My incoming data are "mu" and "DAR"
%DATA of the FLUID (KEPSTAN 6003)
rho=1.27*1000; %density of the fluid Kg/m^3
mu=[1500 1550 1600 1650 1700 1700 1750 1800 1850 1900 1950];%viscosity of the fluid [Pa*s]
DAR=[1.702 2.013 1.391 1.133 1.071 1.024 0.930 0.677 0.631 0.556 0.495];
%MACHINE DATA
m =10; %mass in kg of the weights placed on the piston
D1 =0.02; %tank diameter
D2 =0.0005; %exit hole diameter
A1 =pi*(D1/2)^2; %tank surface
A2 =pi*(D2/2)^2; %surface exit hole
%GIVEN DATA
Ppbar=[145 155 170 195 220 220 235 260 300 350 480]; %pressure in bar
Pp=Ppbar*10000;%pressure in Pa
freq=143;%frequency
FH=(Cc/(g*A2^2));
Qa=FH+a*(rho/2)*(1/(A2^2)-1/(A1^2)); %Qa is the first coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qb=R*mu; %Qb is the second coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qc=-Pp; %Qc is the third coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Delta=(Qb.^2)-4*Qa*Qc;
%EQUATIONS
Flux =(-Qb+sqrt(Delta))/(2*Qa);
DAR_eq=Flux/freq; Hi, i have an equation (DAR_eq) with 3 parameters (R,a,Cc) that i don’t know and i have to find them. I know that the following sentences might be extremly difficult for you but please at least give it a try. I have a tank with a hole which extrude a given material under a pressure. I’ve made an equation (DAR_eq) to solve this problem but i can’t fit my results on it. My incoming data are "mu" and "DAR"
%DATA of the FLUID (KEPSTAN 6003)
rho=1.27*1000; %density of the fluid Kg/m^3
mu=[1500 1550 1600 1650 1700 1700 1750 1800 1850 1900 1950];%viscosity of the fluid [Pa*s]
DAR=[1.702 2.013 1.391 1.133 1.071 1.024 0.930 0.677 0.631 0.556 0.495];
%MACHINE DATA
m =10; %mass in kg of the weights placed on the piston
D1 =0.02; %tank diameter
D2 =0.0005; %exit hole diameter
A1 =pi*(D1/2)^2; %tank surface
A2 =pi*(D2/2)^2; %surface exit hole
%GIVEN DATA
Ppbar=[145 155 170 195 220 220 235 260 300 350 480]; %pressure in bar
Pp=Ppbar*10000;%pressure in Pa
freq=143;%frequency
FH=(Cc/(g*A2^2));
Qa=FH+a*(rho/2)*(1/(A2^2)-1/(A1^2)); %Qa is the first coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qb=R*mu; %Qb is the second coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Qc=-Pp; %Qc is the third coefficient of my 2 grade euation of the flux (Qa*Flux^2+Qb*Flux+Qc=0)
Delta=(Qb.^2)-4*Qa*Qc;
%EQUATIONS
Flux =(-Qb+sqrt(Delta))/(2*Qa);
DAR_eq=Flux/freq; matlab MATLAB Answers — New Questions
Generation of basic signals
I just need the code for generating the basic codes like unit step signal, unit impulse signal. unit ramp signal and the sine wave signal.I just need the code for generating the basic codes like unit step signal, unit impulse signal. unit ramp signal and the sine wave signal. I just need the code for generating the basic codes like unit step signal, unit impulse signal. unit ramp signal and the sine wave signal. code generation MATLAB Answers — New Questions
How to write to csv file in shortG format?
Hello,
I would like to save a Matlab table (first column strings, the rest are floating numbers) to a csv in the shortG format. I have set the format in my script and when I look at the table in the program, it looks just as it should. However, when I save the table to a csv file, the numbers increase their decimal places counts suddenly, forbidding numbers like -6.0247e-06 etc. How to overcome this, please?
Thank you all in advance.Hello,
I would like to save a Matlab table (first column strings, the rest are floating numbers) to a csv in the shortG format. I have set the format in my script and when I look at the table in the program, it looks just as it should. However, when I save the table to a csv file, the numbers increase their decimal places counts suddenly, forbidding numbers like -6.0247e-06 etc. How to overcome this, please?
Thank you all in advance. Hello,
I would like to save a Matlab table (first column strings, the rest are floating numbers) to a csv in the shortG format. I have set the format in my script and when I look at the table in the program, it looks just as it should. However, when I save the table to a csv file, the numbers increase their decimal places counts suddenly, forbidding numbers like -6.0247e-06 etc. How to overcome this, please?
Thank you all in advance. csv, matlab, shortg MATLAB Answers — New Questions
Ramp block having reset option
I would like to implement in simscape a kind of ramp block having reset option, thus that ramp would start rising from zero every time the reset is triggered. I’ve tried with resetable subsystem block but is of no helpfull.
Have u got any idea how to solve this?I would like to implement in simscape a kind of ramp block having reset option, thus that ramp would start rising from zero every time the reset is triggered. I’ve tried with resetable subsystem block but is of no helpfull.
Have u got any idea how to solve this? I would like to implement in simscape a kind of ramp block having reset option, thus that ramp would start rising from zero every time the reset is triggered. I’ve tried with resetable subsystem block but is of no helpfull.
Have u got any idea how to solve this? ramp block, resetable MATLAB Answers — New Questions
Divide connected regions in an image into sub-groups
I have an image (attached as Picture1.png) where the multiple white thick lines are present both in horizontal and vertical directions.
The white lines (either vertical or horizontal) are not always straight and can be curved as shown in picture1. Now, I wish to divide these connected white regions into sub groups, as shown in picture 2. The vertical lines shouldnt undergo fragmentation when criss-crossed by the horizontal lines. Since all the white lines are interconnected to each other, I cannot use regionprops and other similar functions. The numbering of the sub-groups does not need to be in same order as shown in picture 2.
What can be done next? Thank youI have an image (attached as Picture1.png) where the multiple white thick lines are present both in horizontal and vertical directions.
The white lines (either vertical or horizontal) are not always straight and can be curved as shown in picture1. Now, I wish to divide these connected white regions into sub groups, as shown in picture 2. The vertical lines shouldnt undergo fragmentation when criss-crossed by the horizontal lines. Since all the white lines are interconnected to each other, I cannot use regionprops and other similar functions. The numbering of the sub-groups does not need to be in same order as shown in picture 2.
What can be done next? Thank you I have an image (attached as Picture1.png) where the multiple white thick lines are present both in horizontal and vertical directions.
The white lines (either vertical or horizontal) are not always straight and can be curved as shown in picture1. Now, I wish to divide these connected white regions into sub groups, as shown in picture 2. The vertical lines shouldnt undergo fragmentation when criss-crossed by the horizontal lines. Since all the white lines are interconnected to each other, I cannot use regionprops and other similar functions. The numbering of the sub-groups does not need to be in same order as shown in picture 2.
What can be done next? Thank you image processing, image segmentation MATLAB Answers — New Questions
Error with the animation of the surface plot
Hello
I want to perform a surface animation, but I constantly run into an error
Error using surf
Data dimensions must agree.
Error in surfc (line 54)
hs = surf(cax, args{:});
Error in dcSQUID_diode_efficiency_animation (line 26)
surfc(phi,theta,eff)
I would be grateful if someone could tell me where exactly I made a mistake in the code
function z1=dcSQUID_diode_efficiency_animation
tic
phi0=linspace(0.000,2*pi,100);
theta0=linspace(0.000,2*pi,100);
flux1=linspace(0,1,10);
h = figure;
axis tight manual
filename = ‘dc_squid_eff.gif’;
for ii = 1:10
for i=1:100
for j=1:100
y=self11(phi0(i),theta0(j),flux1(ii));
eff(i,j,ii)=y;
end
end
[phi,theta]=meshgrid(phi0,theta0);
surfc(phi,theta,eff)
zlim([-0.5 0.5])
clim([-0.5 0.5])
colormap jet
colorbar(‘FontSize’,34,’FontName’,’Times New Roman’)
set(gca,’FontName’,’Times New Roman’,’FontSize’,34)
xlabel(‘phi’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
ylabel(‘theta’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
set(gca,’XTick’,0:pi/2:2*pi)
set(gca,’XTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
set(gca,’YTick’,0:pi/2:2*pi)
set(gca,’YTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
drawnow
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if ii == 1
imwrite(imind,cm,filename,’gif’, ‘Loopcount’,inf);
else
imwrite(imind,cm,filename,’gif’,’WriteMode’,’append’);
end
end
function z2=self11(phi0,theta0,flux1)
rL1=1;
rL2=1;
rR0=1;
rR1=1;
rR2=1;
x = -2*pi:0.001:2*pi;
I_dc = cos(x./2).*atanh(sin(x./2))+rL1*cos((x+2*phi0)./2).*atanh(sin((x+2*phi0)./2))+rL2*cos((x+2*theta0)./2).*atanh(sin((x+2*theta0)./2))+…
rR0*cos((x-2*pi*flux1)./2).*atanh(sin((x-2*pi*flux1)./2))+rR1*cos(((x-2*pi*flux1)+2*phi0)./2).*atanh(sin(((x-2*pi*flux1)+2*phi0)./2))+…
rR2*cos(((x-2*pi*flux1)+2*theta0)./2).*atanh(sin(((x-2*pi*flux1)+2*theta0)./2));
I_min=min(I_dc);
I_max=max(I_dc);
z2=(I_max-abs(I_min))/(I_max+abs(I_min));
end
toc
endHello
I want to perform a surface animation, but I constantly run into an error
Error using surf
Data dimensions must agree.
Error in surfc (line 54)
hs = surf(cax, args{:});
Error in dcSQUID_diode_efficiency_animation (line 26)
surfc(phi,theta,eff)
I would be grateful if someone could tell me where exactly I made a mistake in the code
function z1=dcSQUID_diode_efficiency_animation
tic
phi0=linspace(0.000,2*pi,100);
theta0=linspace(0.000,2*pi,100);
flux1=linspace(0,1,10);
h = figure;
axis tight manual
filename = ‘dc_squid_eff.gif’;
for ii = 1:10
for i=1:100
for j=1:100
y=self11(phi0(i),theta0(j),flux1(ii));
eff(i,j,ii)=y;
end
end
[phi,theta]=meshgrid(phi0,theta0);
surfc(phi,theta,eff)
zlim([-0.5 0.5])
clim([-0.5 0.5])
colormap jet
colorbar(‘FontSize’,34,’FontName’,’Times New Roman’)
set(gca,’FontName’,’Times New Roman’,’FontSize’,34)
xlabel(‘phi’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
ylabel(‘theta’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
set(gca,’XTick’,0:pi/2:2*pi)
set(gca,’XTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
set(gca,’YTick’,0:pi/2:2*pi)
set(gca,’YTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
drawnow
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if ii == 1
imwrite(imind,cm,filename,’gif’, ‘Loopcount’,inf);
else
imwrite(imind,cm,filename,’gif’,’WriteMode’,’append’);
end
end
function z2=self11(phi0,theta0,flux1)
rL1=1;
rL2=1;
rR0=1;
rR1=1;
rR2=1;
x = -2*pi:0.001:2*pi;
I_dc = cos(x./2).*atanh(sin(x./2))+rL1*cos((x+2*phi0)./2).*atanh(sin((x+2*phi0)./2))+rL2*cos((x+2*theta0)./2).*atanh(sin((x+2*theta0)./2))+…
rR0*cos((x-2*pi*flux1)./2).*atanh(sin((x-2*pi*flux1)./2))+rR1*cos(((x-2*pi*flux1)+2*phi0)./2).*atanh(sin(((x-2*pi*flux1)+2*phi0)./2))+…
rR2*cos(((x-2*pi*flux1)+2*theta0)./2).*atanh(sin(((x-2*pi*flux1)+2*theta0)./2));
I_min=min(I_dc);
I_max=max(I_dc);
z2=(I_max-abs(I_min))/(I_max+abs(I_min));
end
toc
end Hello
I want to perform a surface animation, but I constantly run into an error
Error using surf
Data dimensions must agree.
Error in surfc (line 54)
hs = surf(cax, args{:});
Error in dcSQUID_diode_efficiency_animation (line 26)
surfc(phi,theta,eff)
I would be grateful if someone could tell me where exactly I made a mistake in the code
function z1=dcSQUID_diode_efficiency_animation
tic
phi0=linspace(0.000,2*pi,100);
theta0=linspace(0.000,2*pi,100);
flux1=linspace(0,1,10);
h = figure;
axis tight manual
filename = ‘dc_squid_eff.gif’;
for ii = 1:10
for i=1:100
for j=1:100
y=self11(phi0(i),theta0(j),flux1(ii));
eff(i,j,ii)=y;
end
end
[phi,theta]=meshgrid(phi0,theta0);
surfc(phi,theta,eff)
zlim([-0.5 0.5])
clim([-0.5 0.5])
colormap jet
colorbar(‘FontSize’,34,’FontName’,’Times New Roman’)
set(gca,’FontName’,’Times New Roman’,’FontSize’,34)
xlabel(‘phi’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
ylabel(‘theta’,’FontName’,’Times New Roman’,’fontsize’,34,’fontweight’,’b’);
set(gca,’XTick’,0:pi/2:2*pi)
set(gca,’XTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
set(gca,’YTick’,0:pi/2:2*pi)
set(gca,’YTickLabel’,{‘0′,’pi/2′,’pi’,’3pi/2′,’2pi’})
drawnow
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if ii == 1
imwrite(imind,cm,filename,’gif’, ‘Loopcount’,inf);
else
imwrite(imind,cm,filename,’gif’,’WriteMode’,’append’);
end
end
function z2=self11(phi0,theta0,flux1)
rL1=1;
rL2=1;
rR0=1;
rR1=1;
rR2=1;
x = -2*pi:0.001:2*pi;
I_dc = cos(x./2).*atanh(sin(x./2))+rL1*cos((x+2*phi0)./2).*atanh(sin((x+2*phi0)./2))+rL2*cos((x+2*theta0)./2).*atanh(sin((x+2*theta0)./2))+…
rR0*cos((x-2*pi*flux1)./2).*atanh(sin((x-2*pi*flux1)./2))+rR1*cos(((x-2*pi*flux1)+2*phi0)./2).*atanh(sin(((x-2*pi*flux1)+2*phi0)./2))+…
rR2*cos(((x-2*pi*flux1)+2*theta0)./2).*atanh(sin(((x-2*pi*flux1)+2*theta0)./2));
I_min=min(I_dc);
I_max=max(I_dc);
z2=(I_max-abs(I_min))/(I_max+abs(I_min));
end
toc
end surface plot, animation MATLAB Answers — New Questions
Why do I get “Error: The server response timed out” every time I try to review results in the Polyspace Access Web UI?
I installed and started Polyspace Access, and provided the path to the license file in the "Configure Apps" menu within the Cluster Admin dashboard.
I clicked "Restart Apps" and all the apps are running including the Polyspace Access UI, and I uploaded results to Polyspace Access. I can see the results listed in the web UI, but when I try to review the results I get "Error:The server response timed out" every time.
There is no attempted license checkout https://www.mathworks.com/help/polyspace_access/install/configure-polyspace-access-license.html in the license manager debug log file.I installed and started Polyspace Access, and provided the path to the license file in the "Configure Apps" menu within the Cluster Admin dashboard.
I clicked "Restart Apps" and all the apps are running including the Polyspace Access UI, and I uploaded results to Polyspace Access. I can see the results listed in the web UI, but when I try to review the results I get "Error:The server response timed out" every time.
There is no attempted license checkout https://www.mathworks.com/help/polyspace_access/install/configure-polyspace-access-license.html in the license manager debug log file. I installed and started Polyspace Access, and provided the path to the license file in the "Configure Apps" menu within the Cluster Admin dashboard.
I clicked "Restart Apps" and all the apps are running including the Polyspace Access UI, and I uploaded results to Polyspace Access. I can see the results listed in the web UI, but when I try to review the results I get "Error:The server response timed out" every time.
There is no attempted license checkout https://www.mathworks.com/help/polyspace_access/install/configure-polyspace-access-license.html in the license manager debug log file. MATLAB Answers — New Questions
How Do I Create My Own Hardware Support Package?
I have hardware that I would like to target from MATLAB/Simulink. What resources are available for creating my own hardware support package?I have hardware that I would like to target from MATLAB/Simulink. What resources are available for creating my own hardware support package? I have hardware that I would like to target from MATLAB/Simulink. What resources are available for creating my own hardware support package? hardware, support, embedded, coder, simulink, driver, system MATLAB Answers — New Questions
Mathlab doesn’t show Graph
Can someone tell me why my matlab doesn’t show the graph?I’m getting the results i want but it doesn’t show the graph.
Thanks !Can someone tell me why my matlab doesn’t show the graph?I’m getting the results i want but it doesn’t show the graph.
Thanks ! Can someone tell me why my matlab doesn’t show the graph?I’m getting the results i want but it doesn’t show the graph.
Thanks ! graph, error MATLAB Answers — New Questions
Is the code repo for “co-simulate with unity and matlab” in the seminar “Design and Simulation of Autonomous Surface Vessels (ASV)” available?
The seminar and some GitHub websites are as follows: https://www.mathworks.com/matlabcentral/fileexchange/118968-simulate-navigation-algorithms-of-an-asv
https://github.com/MartinJXLuo/Simulate-Navigation-Algorithms-of-An-Autonomous-Surface-Vessel-ASV-
But it seems that some of the code associated with Unity has not been published by the author yet?The seminar and some GitHub websites are as follows: https://www.mathworks.com/matlabcentral/fileexchange/118968-simulate-navigation-algorithms-of-an-asv
https://github.com/MartinJXLuo/Simulate-Navigation-Algorithms-of-An-Autonomous-Surface-Vessel-ASV-
But it seems that some of the code associated with Unity has not been published by the author yet? The seminar and some GitHub websites are as follows: https://www.mathworks.com/matlabcentral/fileexchange/118968-simulate-navigation-algorithms-of-an-asv
https://github.com/MartinJXLuo/Simulate-Navigation-Algorithms-of-An-Autonomous-Surface-Vessel-ASV-
But it seems that some of the code associated with Unity has not been published by the author yet? uav,asv,unity MATLAB Answers — New Questions
reed solomon code over odd characteristic field
please help! how can i obtain a gen matrix and gen polynimial for reed solomon codes over odd characteristic field? all tolls that i found were intended for fields over GF(2^m).please help! how can i obtain a gen matrix and gen polynimial for reed solomon codes over odd characteristic field? all tolls that i found were intended for fields over GF(2^m). please help! how can i obtain a gen matrix and gen polynimial for reed solomon codes over odd characteristic field? all tolls that i found were intended for fields over GF(2^m). reed-solomon, rs MATLAB Answers — New Questions
How to use looping method to crop image dynamically (auto-cropping)?
Hello. How to crop image using dynamic cropping method in matlab? Is there any example implementation codes?
Lets say, my original image have two different sizes which are 482 x 841 pixels and 608 x 865 pixels, so can I use loop step at first to extend the pixels which those that not enough pixels if I want to crop into 512 x 512 pixels? If the image size is enough to crop into 512 x512 pixels so no need to extend the pixels. I recently use this code:-
%To read input image
I=imread(‘1_776.jpg’);
imfinfo(‘1_776.jpg’)
First image, image size 482 x 841 px
Second image, image size 608 x 865 px
%To resize image
out = padarray(I, [10 10], 0, ‘both’);
imshow(out);
imwrite(out,’resize1.jpg’);
but this is manual. Now I want it to automatically crop only specific area.Hello. How to crop image using dynamic cropping method in matlab? Is there any example implementation codes?
Lets say, my original image have two different sizes which are 482 x 841 pixels and 608 x 865 pixels, so can I use loop step at first to extend the pixels which those that not enough pixels if I want to crop into 512 x 512 pixels? If the image size is enough to crop into 512 x512 pixels so no need to extend the pixels. I recently use this code:-
%To read input image
I=imread(‘1_776.jpg’);
imfinfo(‘1_776.jpg’)
First image, image size 482 x 841 px
Second image, image size 608 x 865 px
%To resize image
out = padarray(I, [10 10], 0, ‘both’);
imshow(out);
imwrite(out,’resize1.jpg’);
but this is manual. Now I want it to automatically crop only specific area. Hello. How to crop image using dynamic cropping method in matlab? Is there any example implementation codes?
Lets say, my original image have two different sizes which are 482 x 841 pixels and 608 x 865 pixels, so can I use loop step at first to extend the pixels which those that not enough pixels if I want to crop into 512 x 512 pixels? If the image size is enough to crop into 512 x512 pixels so no need to extend the pixels. I recently use this code:-
%To read input image
I=imread(‘1_776.jpg’);
imfinfo(‘1_776.jpg’)
First image, image size 482 x 841 px
Second image, image size 608 x 865 px
%To resize image
out = padarray(I, [10 10], 0, ‘both’);
imshow(out);
imwrite(out,’resize1.jpg’);
but this is manual. Now I want it to automatically crop only specific area. loops MATLAB Answers — New Questions
My code is not working or MATLAB is not responding?
I’m currently working on designing a dynamic interface, which necessitates taking a cell array input from the user.
I’ve encountered an unexpected behavior while attempting this in MATLAB. Instead of storing the cell array in the workspace, the input statement appears multiple times in the command window.
Even when providing a normal numeric array like 1 2 3 4 5, it fails to work as expected.
surprisingly, there are no visible warnings or errors, leaving me uncertain whether there’s an issue with my code or if MATLAB itself is hanging.
Looking forward for assistance in resolving this issueI’m currently working on designing a dynamic interface, which necessitates taking a cell array input from the user.
I’ve encountered an unexpected behavior while attempting this in MATLAB. Instead of storing the cell array in the workspace, the input statement appears multiple times in the command window.
Even when providing a normal numeric array like 1 2 3 4 5, it fails to work as expected.
surprisingly, there are no visible warnings or errors, leaving me uncertain whether there’s an issue with my code or if MATLAB itself is hanging.
Looking forward for assistance in resolving this issue I’m currently working on designing a dynamic interface, which necessitates taking a cell array input from the user.
I’ve encountered an unexpected behavior while attempting this in MATLAB. Instead of storing the cell array in the workspace, the input statement appears multiple times in the command window.
Even when providing a normal numeric array like 1 2 3 4 5, it fails to work as expected.
surprisingly, there are no visible warnings or errors, leaving me uncertain whether there’s an issue with my code or if MATLAB itself is hanging.
Looking forward for assistance in resolving this issue matlab code, input MATLAB Answers — New Questions
How to Scale Gradient Field for large z-values?
I want to plot a function R^2 -> R with gradient Field beneath:
f2 = @(x,y) 1./sqrt(x.^2+y.^2);
[u2,v2] = meshgrid(-1:0.01:1);
[du2,dv2] = gradient(f2(u2,v2));
s = surf(u2,v2,f2(u2,v2));
hold on
contour(u2,v2,f2(u2,v2))
hold on
norm = 1./sqrt(du2.^2+dv2.^2);
quiver(u2,v2,du2./norm,dv2./norm,’LineWidth’,2)
axis([-1 1 -1 1 0 10])
caxis([0,10])
colormap(cool)
alpha(s,0.95)
shading flat
Sadly the gradient field is not visible. Probably because it’s too small, f2 get’s too large and I’m lacking of the mathmatical knowledge to adjust it properlyI want to plot a function R^2 -> R with gradient Field beneath:
f2 = @(x,y) 1./sqrt(x.^2+y.^2);
[u2,v2] = meshgrid(-1:0.01:1);
[du2,dv2] = gradient(f2(u2,v2));
s = surf(u2,v2,f2(u2,v2));
hold on
contour(u2,v2,f2(u2,v2))
hold on
norm = 1./sqrt(du2.^2+dv2.^2);
quiver(u2,v2,du2./norm,dv2./norm,’LineWidth’,2)
axis([-1 1 -1 1 0 10])
caxis([0,10])
colormap(cool)
alpha(s,0.95)
shading flat
Sadly the gradient field is not visible. Probably because it’s too small, f2 get’s too large and I’m lacking of the mathmatical knowledge to adjust it properly I want to plot a function R^2 -> R with gradient Field beneath:
f2 = @(x,y) 1./sqrt(x.^2+y.^2);
[u2,v2] = meshgrid(-1:0.01:1);
[du2,dv2] = gradient(f2(u2,v2));
s = surf(u2,v2,f2(u2,v2));
hold on
contour(u2,v2,f2(u2,v2))
hold on
norm = 1./sqrt(du2.^2+dv2.^2);
quiver(u2,v2,du2./norm,dv2./norm,’LineWidth’,2)
axis([-1 1 -1 1 0 10])
caxis([0,10])
colormap(cool)
alpha(s,0.95)
shading flat
Sadly the gradient field is not visible. Probably because it’s too small, f2 get’s too large and I’m lacking of the mathmatical knowledge to adjust it properly gradient MATLAB Answers — New Questions
How to import 2D finite element data from Matlab to Paraview?
Hello everyone!
I have 2D finite element data that are generated in matlab and I am trying to use this code for post-processing in Paraview:
https://www.mathworks.com/matlabcentral/fileexchange/47814-vtkwrite-exports-various-2d-3d-data-to-paraview-in-vtk-file-format.
I have the following matrices:
1) CRD(# of nodes, 2) which gives the 2D coordinates of the nodes,
2) Nodes(# of nodes per element,# of elements) which provides the connectivity between the nodes,
3) U(# of nodes, 2) which gives the x & y velocities per node, and
4) P(# of nodes, 1) which gives the pressure on a node.
However, I am not quite sure how can I put all these in the appropriate form so that they are compatible with the code. I went through several trials but it seems that the data are not saved properly. I would appreciate your help!Hello everyone!
I have 2D finite element data that are generated in matlab and I am trying to use this code for post-processing in Paraview:
https://www.mathworks.com/matlabcentral/fileexchange/47814-vtkwrite-exports-various-2d-3d-data-to-paraview-in-vtk-file-format.
I have the following matrices:
1) CRD(# of nodes, 2) which gives the 2D coordinates of the nodes,
2) Nodes(# of nodes per element,# of elements) which provides the connectivity between the nodes,
3) U(# of nodes, 2) which gives the x & y velocities per node, and
4) P(# of nodes, 1) which gives the pressure on a node.
However, I am not quite sure how can I put all these in the appropriate form so that they are compatible with the code. I went through several trials but it seems that the data are not saved properly. I would appreciate your help! Hello everyone!
I have 2D finite element data that are generated in matlab and I am trying to use this code for post-processing in Paraview:
https://www.mathworks.com/matlabcentral/fileexchange/47814-vtkwrite-exports-various-2d-3d-data-to-paraview-in-vtk-file-format.
I have the following matrices:
1) CRD(# of nodes, 2) which gives the 2D coordinates of the nodes,
2) Nodes(# of nodes per element,# of elements) which provides the connectivity between the nodes,
3) U(# of nodes, 2) which gives the x & y velocities per node, and
4) P(# of nodes, 1) which gives the pressure on a node.
However, I am not quite sure how can I put all these in the appropriate form so that they are compatible with the code. I went through several trials but it seems that the data are not saved properly. I would appreciate your help! paraview, finite element data MATLAB Answers — New Questions