Call Matlab function in asp.net (Web Form)
Stack Overflow » MATLAB
by Hamid Reza Amir
13h ago
I writed a function (m.file) in matlab and want to use it in ASP.Net (Web Form) project. I do library compiler works and add dlls to references of asp.net project, but when run the project VS sended this Error: "System.TypeInitializationException: 'The type initializer for 'fis1.Class1' threw an exception BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)". I do this steps in Windows Form Application and used dlls files and work correct, but in asp project, after run i have error and see Exception throw. can anyone expl ..read more
Visit website
Line in Matlab plot do not appear
Stack Overflow » MATLAB
by Homer Jay Simpson
16h ago
I am self studying Matlab and I want to create a plot with electron modility and inverse temperature as the picture shows: I have created a code in matlab but I do not see the line in the plot .Why ? % Constants k = 1.38e-23; % Boltzmann's constant (J/K) Eg = 1.12; % Energy band gap of silicon (eV) A = 2.5e19; % Constant for intrinsic carrier concentration calculation Nc = 2.8e19; % Effective density of states in conduction band (cm^-3) Nd = 1e16; % Doping concentration (cm^-3) % Temperature range T = linspace(100, 1000, 100); % Temperature range from 100 K to 1000 K % Elect ..read more
Visit website
Optimal weights loop for a added sum optimization problem
Stack Overflow » MATLAB
by Trex
18h ago
I have an optimization objective (f1) which is basically weighted sum approach for optimization f1 = (w(1)*a)+(w(2)*b)+(w(3)*c)+(w(4)*d)+(w(5)*e) suppose optimizing variables are [a,b,c,d,e] and corresponding 5 weights (w(1),w(2)...) are set randomly (all ones initially). I currently was using FMINCON-(interior point method) in MATLAB to minimize f1 with the constrains and it optimizes well (for whatever the weights i choose). after optimizing (f1) I use this:- X = max[a,b,c,d,e](basically just a number) now after optimization of (f1) we get X; we reiterate weights until I get a lower value ..read more
Visit website
Error in iterating over two loops in MATLAB
Stack Overflow » MATLAB
by H. Walker
22h ago
I'm writing a MATLAB script to assign ratings to people with a certain batting average score. For example, if it was below .200, it would be Bad, .220 is Below Average etc. I wrote this code to loop over every player in a table, then every rating to find the score to assign: ratings = {'Bad', 'Below Average', 'Average', 'Above average', 'Great', 'Elite'}; AVGRatings = \[0.200, 0.220, 0.255, 0.280, 0.310, 0.340, inf\]; for j = 1:numel(AVGRatings) for i = 1:height(Batting) if Batting.AVG(i) < AVGRatings(j) Batting.AVG_Rating{i} = ratings{j}; break ..read more
Visit website
Surface plot of x,y,z Data with Different z Dimension MATLAB
Stack Overflow » MATLAB
by Jonathan Frutschy
1d ago
I have the following data: M = 100; % [seconds] D = 50; % number of masses t = [0:dt:M]; y = randn(length(t),1); % [unitless] amplitude z = [1:1:2*D]; % [unitless] number of eigenfrequencies data = [t,y,z]; I would like to create a surface plot of data where the x-axis is t or time, the y-axis is y or amplitude, and the z-axis is eigenfrequency number. The x and y data both have a dimension of t, but the z-data has a dimension of 2D. Is it possible to plot x,y,z data using z data with a different dimension than the x and y data in MATLAB using surf() or plot3 ..read more
Visit website
Implement Variable Step Size for Nonlinear Function MATLAB
Stack Overflow » MATLAB
by Jonathan Frutschy
1d ago
I have the following function that returns a nonlinear signal as a function of time: function y = NARMA_optimized(u,mu,delta,phi,psi,m,N,k) y = zeros(N,1); % y(0)=0, and also y(-1)=0 etc. t = 1; y(t) = mu.* u(t-m-k).* u(t-k) + delta; for t = 2:N v = 1; for i = 1:m if t-i > 0 % else we add 0 v = v + y(t-i); end end v = phi.*y(t-1) + v.*psi.*y(t-1) + mu.*u(t-m-k).*u(t-k) + delta; y(t) = v; end end To call the function, I do the following: % NARMA Model Comparison alpha = 0.2; beta = 0.15; f_0_i = 1; delta = 0.1; Mu = 1.5; m = 10; phi = 0 ..read more
Visit website
Importing Data Faster in MATLAB
Stack Overflow » MATLAB
by Seth Brock
1d ago
I have this code in MATLAB: opts = detectImportOptions("Data-2013.txt"); opts = setvartype(opts,{...}); opts = setvartype(opts,{...},'string'); Table_2013 = readtable('Data-2013.txt',opts); Table_2014 = readtable('Data-2014.txt',opts); Table_2015 = readtable('Data-2015.txt',opts); Table_2016 = readtable('Data-2016.txt',opts); Table_2017 = readtable('Data-2017.txt',opts); Table_2018 = readtable('Data-2018.txt',opts); Table_2019 = readtable('Data-2019.txt',opts); Table_2020 = readtable('Data-2020.txt',opts); Table_2021 = readtable('Data-2021.txt',opts); Table_2022 = readtable('Data-2022.txt',o ..read more
Visit website
How to train a pytorch model with an unknown matlab function inside the loss function?
Stack Overflow » MATLAB
by Kilian
2d ago
I am currently trying to implement a custom loss function to train a neural network using Python and Pytorch. The Problem is that my function calls another function in Matlab to calculate some values. Let's call this Matlab function M1(y). So basically my Loss function is Loss(y,t) = M1(y) - M2(t) where y is the predicted value of the model, t is the actual target value and M2(t) is another Matlab function. Is there a way I can calculate a gradient and train the model without knowing the details of M1 and M2? I believe it should be possible to approximate the gradient using something like ..read more
Visit website
SImulation model and state space model giving different output
Stack Overflow » MATLAB
by raghavp01
2d ago
I am working on a power electronics project, and am facing a problem with simulink. I am trying to find the transfer function of a SEPIC converter using state space analysis method. I am able to calculate the transfer function using the state matrices A,B,C and D. I aim to verify if the matrices have been calculated correctly by running the simulation of the converter as well as the state space model in simulink. The converter model gives the correct expected output, but the state space model is giving incorrect output. Since the state space model should represent the converter in continuous m ..read more
Visit website
How to change the duty cycle of a square wave without introducing any change in the pulse generaror in MATLAB simulink?
Stack Overflow » MATLAB
by Himangshu Chetia
2d ago
I have four square waves S1, S2, S3 and S4. All have 50% duty cycle. When S1 is on S2 is off (vice versa) and when S4 is on S3 is off (vice versa). I want to change the duty cycle of S1 and S3 to more than 50 % and the duty cycle of S2 and S4 to less than 50% of the period (as shown in the figure), without introducing any change in the pulse generator, i.e. the change has to be done outside the pulse generator.How do I do it in MATLAB simulink? Image of the pulses in required fashion The pulses are generated using a sawtooth generator, hit crossing block and SR flip-flop ..read more
Visit website

Follow Stack Overflow » MATLAB on FeedSpot

Continue with Google
Continue with Apple
OR